diff options
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 6 | ||||
-rw-r--r-- | Zotlabs/Daemon/Externals.php | 2 | ||||
-rw-r--r-- | Zotlabs/Daemon/Onepoll.php | 2 | ||||
-rw-r--r-- | Zotlabs/Daemon/Poller.php | 6 | ||||
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Admin.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Profiles.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Removeaccount.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Removeme.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Tokens.php | 2 | ||||
-rw-r--r-- | include/account.php | 4 | ||||
-rw-r--r-- | include/channel.php | 2 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rw-r--r-- | include/datetime.php | 22 | ||||
-rwxr-xr-x | include/dba/dba_driver.php | 18 | ||||
-rw-r--r-- | include/dir_fns.php | 2 | ||||
-rw-r--r-- | include/feedutils.php | 4 | ||||
-rw-r--r-- | include/import.php | 8 | ||||
-rwxr-xr-x | include/items.php | 10 | ||||
-rw-r--r-- | install/schema_mysql.sql | 128 | ||||
-rw-r--r-- | install/update.php | 76 |
21 files changed, 155 insertions, 149 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 613c2e705..924667b05 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -43,14 +43,14 @@ class Cron { // expire any expired mail - q("delete from mail where expires != '%s' and expires < %s ", + q("delete from mail where expires > '%s' and expires < %s ", dbesc(NULL_DATE), db_utcnow() ); // expire any expired items - $r = q("select id from item where expires != '%s' and expires < %s + $r = q("select id from item where expires > '%s' and expires < %s and item_deleted = 0 ", dbesc(NULL_DATE), db_utcnow() @@ -64,7 +64,7 @@ class Cron { // delete expired access tokens - $r = q("select atoken_id from atoken where atoken_expires != '%s' and atoken_expires < %s", + $r = q("select atoken_id from atoken where atoken_expires > '%s' and atoken_expires < %s", dbesc(NULL_DATE), db_utcnow() ); diff --git a/Zotlabs/Daemon/Externals.php b/Zotlabs/Daemon/Externals.php index 24cfe64ec..a9988a509 100644 --- a/Zotlabs/Daemon/Externals.php +++ b/Zotlabs/Daemon/Externals.php @@ -58,7 +58,7 @@ class Externals { } if($url) { - if($r[0]['site_pull'] !== NULL_DATE) + if($r[0]['site_pull'] > NULL_DATE) $mindate = urlencode(datetime_convert('','',$r[0]['site_pull'] . ' - 1 day')); else { $days = get_config('externals','since_days'); diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index bebf8bf17..33b244dc5 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -54,7 +54,7 @@ class Onepoll { logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['xchan_name']}, CONTACT: {$contact['xchan_name']}"); - $last_update = ((($contact['abook_updated'] === $contact['abook_created']) || ($contact['abook_updated'] === NULL_DATE)) + $last_update = ((($contact['abook_updated'] === $contact['abook_created']) || ($contact['abook_updated'] <= NULL_DATE)) ? datetime_convert('UTC','UTC','now - 7 days') : datetime_convert('UTC','UTC',$contact['abook_updated'] . ' - 2 days') ); diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php index 75efbf8f7..e4bc9c143 100644 --- a/Zotlabs/Daemon/Poller.php +++ b/Zotlabs/Daemon/Poller.php @@ -117,7 +117,7 @@ class Poller { // if we've never connected with them, start the mark for death countdown from now - if($c == NULL_DATE) { + if($c <= NULL_DATE) { $r = q("update abook set abook_connected = '%s' where abook_id = %d", dbesc(datetime_convert()), intval($contact['abook_id']) @@ -171,7 +171,7 @@ class Poller { } if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { - $r = q("SELECT u.ud_addr, u.ud_id, u.ud_last FROM updates AS u INNER JOIN (SELECT ud_addr, max(ud_id) AS ud_id FROM updates WHERE ( ud_flags & %d ) = 0 AND ud_addr != '' AND ( ud_last = '%s' OR ud_last > %s - INTERVAL %s ) GROUP BY ud_addr) AS s ON s.ud_id = u.ud_id ", + $r = q("SELECT u.ud_addr, u.ud_id, u.ud_last FROM updates AS u INNER JOIN (SELECT ud_addr, max(ud_id) AS ud_id FROM updates WHERE ( ud_flags & %d ) = 0 AND ud_addr != '' AND ( ud_last <= '%s' OR ud_last > %s - INTERVAL %s ) GROUP BY ud_addr) AS s ON s.ud_id = u.ud_id ", intval(UPDATE_FLAGS_UPDATED), dbesc(NULL_DATE), db_utcnow(), db_quoteinterval('7 DAY') @@ -182,7 +182,7 @@ class Poller { // If they didn't respond when we attempted before, back off to once a day // After 7 days we won't bother anymore - if($rr['ud_last'] != NULL_DATE) + if($rr['ud_last'] > NULL_DATE) if($rr['ud_last'] > datetime_convert('UTC','UTC', 'now - 1 day')) continue; Master::Summon(array('Onedirsync',$rr['ud_id'])); diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index ef73ed793..a3e871810 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -349,7 +349,7 @@ class ThreadItem { 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''), - 'expiretime' => (($item['expires'] !== NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), + 'expiretime' => (($item['expires'] > NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), 'lock' => $lock, 'verified' => $verified, 'unverified' => $unverified, diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index e6a29fd8d..e3702992f 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -87,7 +87,7 @@ class Admin extends \Zotlabs\Web\Controller { // list total user accounts, expirations etc. $accounts = array(); - $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN account_expires > %s THEN 1 ELSE NULL END) AS expiring, COUNT(CASE WHEN account_expires < %s AND account_expires != '%s' THEN 1 ELSE NULL END) AS expired, COUNT(CASE WHEN (account_flags & %d)>0 THEN 1 ELSE NULL END) AS blocked FROM account", + $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN account_expires > %s THEN 1 ELSE NULL END) AS expiring, COUNT(CASE WHEN account_expires < %s AND account_expires > '%s' THEN 1 ELSE NULL END) AS expired, COUNT(CASE WHEN (account_flags & %d)>0 THEN 1 ELSE NULL END) AS blocked FROM account", db_utcnow(), db_utcnow(), dbesc(NULL_DATE), diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 4b05182c2..788673296 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -724,7 +724,7 @@ class Profiles extends \Zotlabs\Web\Controller { '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), '$with' => array('with', t("Who (if applicable)"), $r[0]['partner'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), - '$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), + '$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), '$about' => array('about', t('Tell us about yourself'), $r[0]['about']), diff --git a/Zotlabs/Module/Removeaccount.php b/Zotlabs/Module/Removeaccount.php index 9fac7838e..9d2bbd0de 100644 --- a/Zotlabs/Module/Removeaccount.php +++ b/Zotlabs/Module/Removeaccount.php @@ -29,7 +29,7 @@ class Removeaccount extends \Zotlabs\Web\Controller { if(! ($x && $x['account'])) return; - if($account['account_password_changed'] != NULL_DATE) { + if($account['account_password_changed'] > NULL_DATE) { $d1 = datetime_convert('UTC','UTC','now - 48 hours'); if($account['account_password_changed'] > d1) { notice( t('Account removals are not allowed within 48 hours of changing the account password.') . EOL); diff --git a/Zotlabs/Module/Removeme.php b/Zotlabs/Module/Removeme.php index bc18fe0f8..ca2080e83 100644 --- a/Zotlabs/Module/Removeme.php +++ b/Zotlabs/Module/Removeme.php @@ -29,7 +29,7 @@ class Removeme extends \Zotlabs\Web\Controller { if(! ($x && $x['account'])) return; - if($account['account_password_changed'] != NULL_DATE) { + if($account['account_password_changed'] > NULL_DATE) { $d1 = datetime_convert('UTC','UTC','now - 48 hours'); if($account['account_password_changed'] > d1) { notice( t('Channel removals are not allowed within 48 hours of changing the account password.') . EOL); diff --git a/Zotlabs/Module/Settings/Tokens.php b/Zotlabs/Module/Settings/Tokens.php index 0ae960785..e63fed128 100644 --- a/Zotlabs/Module/Settings/Tokens.php +++ b/Zotlabs/Module/Settings/Tokens.php @@ -156,7 +156,7 @@ class Tokens { '$url2' => z_root() . '/photos/' . $channel['channel_address'], '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', (($atoken) ? $atoken['atoken_name'] : ''),''), '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>',(($atoken) ? $atoken['atoken_token'] : autoname(8)), ''), - '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), (($atoken['atoken_expires'] && $atoken['atoken_expires'] != NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''), + '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), (($atoken['atoken_expires'] && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''), '$them' => t('Their Settings'), '$me' => t('My Settings'), '$perms' => $perms, diff --git a/include/account.php b/include/account.php index 47310912f..bd4da6a52 100644 --- a/include/account.php +++ b/include/account.php @@ -548,8 +548,8 @@ function account_approve($hash) { */ function downgrade_accounts() { - $r = q("select * from account where not ( account_flags & %d )>0 - and account_expires != '%s' + $r = q("select * from account where not ( account_flags & %d ) > 0 + and account_expires > '%s' and account_expires < %s ", intval(ACCOUNT_EXPIRED), dbesc(NULL_DATE), diff --git a/include/channel.php b/include/channel.php index 5beb4a53c..c86cea6f1 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1212,7 +1212,7 @@ function advanced_profile(&$a) { if(App::$profile['partner']) $profile['marital']['partner'] = bbcode(App::$profile['partner']); - if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) { + if(strlen(App::$profile['howlong']) && App::$profile['howlong'] > NULL_DATE) { $profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s')); } diff --git a/include/conversation.php b/include/conversation.php index 1cac60bf9..287dd4983 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -721,7 +721,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''), - 'expiretime' => (($item['expires'] !== NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), + 'expiretime' => (($item['expires'] > NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), 'location' => $location, 'indent' => '', 'owner_name' => $owner_name, diff --git a/include/datetime.php b/include/datetime.php index 76bd6b8d6..cd08ab367 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -24,6 +24,13 @@ function timezone_cmp($a, $b) { return ( t($a) < t($b)) ? -1 : 1; } +function is_null_date($s) { + if($s === '0000-00-00 00:00:00' || $s === '0001-01-01 00:00:00') + return true; + return false; +} + + /** * @brief Return timezones grouped (primarily) by continent. * @@ -78,15 +85,20 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d if( ($s === '') || (! is_string($s)) ) $s = 'now'; + if(is_null_date($s)) { + $d = new DateTime('0001-01-01 00:00:00', new DateTimeZone('UTC')); + return $d->format($fmt); + } + // Slight hackish adjustment so that 'zero' datetime actually returns what is intended // otherwise we end up with -0001-11-30 ... // add 32 days so that we at least get year 00, and then hack around the fact that // months and days always start with 1. - if(substr($s,0,10) == '0000-00-00') { - $d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC')); - return str_replace('1', '0', $d->format($fmt)); - } +// if(substr($s,0,10) == '0000-00-00') { +// $d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC')); +// return str_replace('1', '0', $d->format($fmt)); +// } try { $from_obj = new DateTimeZone($from); @@ -268,7 +280,7 @@ function relative_date($posted_date, $format = null) { $abs = strtotime($localtime); - if (is_null($posted_date) || $posted_date === NULL_DATE || $abs === false) { + if (is_null($posted_date) || is_null_date($posted_date) || $abs === false) { return t('never'); } diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 7225a9be2..2cbdd529d 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -86,7 +86,7 @@ class DBA { abstract class dba_driver { // legacy behavior const INSTALL_SCRIPT='install/schema_mysql.sql'; - const NULL_DATE = '0000-00-00 00:00:00'; + const NULL_DATE = '0001-01-01 00:00:00'; const UTC_NOW = 'UTC_TIMESTAMP()'; protected $db; @@ -276,12 +276,9 @@ function dbunescbin($str) { } function dbescdate($date) { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES && $date == '0000-00-00 00:00:00') { - $date = NULL_DATE; - } else if(ACTIVE_DBTYPE != DBTYPE_POSTGRES && $date == '0001-01-01 00:00:00') { - $date = NULL_DATE; - } - return $date; + if(is_null_date($date)) + return $dba->escape(NULL_DATE); + return $dba->escape($date); } function db_quoteinterval($txt) { @@ -376,11 +373,8 @@ function dbq($sql) { function dbesc_array_cb(&$item, $key) { if(is_string($item)) { - if($item == '0000-00-00 00:00:00' && ACTIVE_DBTYPE == DBTYPE_POSTGRES) - $item = '0001-01-01 00:00:00'; - else if($item == '0001-01-01 00:00:00' && ACTIVE_DBTYPE == DBTYPE_MYSQL) - $item = '0000-00-00 00:00:00'; - + if(is_null_date($item)) + $item = NULL_DATE; $item = dbesc($item); } } diff --git a/include/dir_fns.php b/include/dir_fns.php index 53a81b242..03cc2706a 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -227,7 +227,7 @@ function sync_directories($dirmode) { $token = get_config('system','realm_token'); - $syncdate = (($rr['site_sync'] === NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']); + $syncdate = (($rr['site_sync'] <= NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']); $x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate) . (($token) ? '&t=' . $token : '')); if (! $x['success']) diff --git a/include/feedutils.php b/include/feedutils.php index 01ec0687e..1d58ec317 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -33,7 +33,7 @@ function get_public_feed($channel, $params) { // put a sane lower limit on feed requests if not specified -// if($params['begin'] === NULL_DATE) +// if($params['begin'] <= NULL_DATE) // $params['begin'] = datetime_convert('UTC','UTC','now - 1 month'); switch($params['type']) { @@ -884,7 +884,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { $datarray['owner_xchan'] = $contact['xchan_hash']; - if(array_key_exists('created',$datarray) && $datarray['created'] != NULL_DATE && $expire_days) { + if(array_key_exists('created',$datarray) && $datarray['created'] > NULL_DATE && $expire_days) { $t1 = $datarray['created']; $t2 = datetime_convert('UTC','UTC','now - ' . $expire_days . 'days'); if($t1 < $t2) { diff --git a/include/import.php b/include/import.php index 15aa7c2b3..1d636bfbd 100644 --- a/include/import.php +++ b/include/import.php @@ -422,9 +422,9 @@ function sync_apps($channel,$apps) { ); } - if(! $app['app_created'] || $app['app_created'] === NULL_DATE) + if((! $app['app_created']) || ($app['app_created'] <= NULL_DATE)) $app['app_created'] = datetime_convert(); - if(! $app['app_edited'] || $app['app_edited'] === NULL_DATE) + if((! $app['app_edited']) || ($app['app_edited'] <= NULL_DATE)) $app['app_edited'] = datetime_convert(); $app['app_channel'] = $channel['channel_id']; @@ -536,9 +536,9 @@ function sync_chatrooms($channel,$chatrooms) { unset($chatroom['cr_aid']); unset($chatroom['cr_uid']); - if(! $chatroom['cr_created'] || $chatroom['cr_created'] === NULL_DATE) + if((! $chatroom['cr_created']) || ($chatroom['cr_created'] <= NULL_DATE)) $chatroom['cr_created'] = datetime_convert(); - if(! $chatroom['cr_edited'] || $chatroom['cr_edited'] === NULL_DATE) + if((! $chatroom['cr_edited']) || ($chatroom['cr_edited'] <= NULL_DATE)) $chatroom['cr_edited'] = datetime_convert(); $chatroom['cr_aid'] = $channel['channel_account_id']; diff --git a/include/items.php b/include/items.php index 55bdcf8ef..c62d53c3e 100755 --- a/include/items.php +++ b/include/items.php @@ -163,7 +163,7 @@ function collect_recipients($item, &$private_envelope) { } function comments_are_now_closed($item) { - if($item['comments_closed'] !== NULL_DATE) { + if($item['comments_closed'] > NULL_DATE) { $d = datetime_convert(); if($d > $item['comments_closed']) return true; @@ -1090,7 +1090,7 @@ function encode_item($item,$mirror = false) { if($y = encode_item_flags($item)) $x['flags'] = $y; - if($item['comments_closed'] !== NULL_DATE) + if($item['comments_closed'] > NULL_DATE) $x['comments_closed'] = $item['comments_closed']; $x['public_scope'] = $scope; @@ -1439,7 +1439,7 @@ function get_mail_elements($x) { $arr['conv_guid'] = (($x['conv_guid'])? htmlspecialchars($x['conv_guid'],ENT_COMPAT,'UTF-8',false) : ''); $arr['created'] = datetime_convert('UTC','UTC',$x['created']); - if((! array_key_exists('expires',$x)) || ($x['expires'] === NULL_DATE)) + if((! array_key_exists('expires',$x)) || ($x['expires'] <= NULL_DATE)) $arr['expires'] = NULL_DATE; else $arr['expires'] = datetime_convert('UTC','UTC',$x['expires']); @@ -2065,7 +2065,7 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) { $arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert()); $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : $orig[0]['expires']); - if(array_key_exists('comments_closed',$arr) && $arr['comments_closed'] != NULL_DATE) + if(array_key_exists('comments_closed',$arr) && $arr['comments_closed'] > NULL_DATE) $arr['comments_closed'] = datetime_convert('UTC','UTC',$arr['comments_closed']); else $arr['comments_closed'] = $orig[0]['comments_closed']; @@ -3832,7 +3832,7 @@ function zot_feed($uid,$observer_hash,$arr) { $limit = " LIMIT 100 "; - if($mindate != NULL_DATE) { + if($mindate > NULL_DATE) { $sql_extra .= " and ( created > '$mindate' or changed > '$mindate' ) "; } diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 9a4f58880..d72684a90 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -21,10 +21,10 @@ CREATE TABLE IF NOT EXISTS `abook` ( `abook_my_perms` int(11) NOT NULL DEFAULT '0', `abook_their_perms` int(11) NOT NULL DEFAULT '0', `abook_closeness` tinyint(3) unsigned NOT NULL DEFAULT '99', - `abook_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `abook_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `abook_connected` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `abook_dob` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `abook_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `abook_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `abook_connected` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `abook_dob` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `abook_flags` int(11) NOT NULL DEFAULT '0', `abook_blocked` tinyint(4) NOT NULL DEFAULT '0', `abook_ignored` tinyint(4) NOT NULL DEFAULT '0', @@ -70,16 +70,16 @@ CREATE TABLE IF NOT EXISTS `account` ( `account_email` char(255) NOT NULL DEFAULT '', `account_external` char(255) NOT NULL DEFAULT '', `account_language` char(16) NOT NULL DEFAULT 'en', - `account_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `account_lastlog` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `account_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `account_lastlog` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `account_flags` int(10) unsigned NOT NULL DEFAULT '0', `account_roles` int(10) unsigned NOT NULL DEFAULT '0', `account_reset` char(255) NOT NULL DEFAULT '', - `account_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `account_expire_notified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `account_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `account_expire_notified` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `account_service_class` char(32) NOT NULL DEFAULT '', `account_level` int(10) unsigned NOT NULL DEFAULT '0', - `account_password_changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `account_password_changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`account_id`), KEY `account_email` (`account_email`), KEY `account_service_class` (`account_service_class`), @@ -125,8 +125,8 @@ CREATE TABLE IF NOT EXISTS `app` ( `app_requires` char(255) NOT NULL DEFAULT '', `app_deleted` int(11) NOT NULL DEFAULT '0', `app_system` int(11) NOT NULL DEFAULT '0', - `app_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `app_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `app_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `app_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`id`), KEY `app_id` (`app_id`), KEY `app_name` (`app_name`), @@ -148,7 +148,7 @@ CREATE TABLE IF NOT EXISTS `atoken` ( `atoken_uid` int(11) NOT NULL DEFAULT 0, `atoken_name` char(255) NOT NULL DEFAULT '', `atoken_token` char(255) NOT NULL DEFAULT '', - `atoken_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `atoken_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`atoken_id`), KEY `atoken_aid` (`atoken_aid`), KEY `atoken_uid` (`atoken_uid`), @@ -176,8 +176,8 @@ CREATE TABLE IF NOT EXISTS `attach` ( `os_path` mediumtext NOT NULL, `display_path` mediumtext NOT NULL, `content` longblob NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, @@ -212,7 +212,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` ( CREATE TABLE IF NOT EXISTS `cache` ( `k` char(255) NOT NULL DEFAULT '', `v` text NOT NULL, - `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -253,9 +253,9 @@ CREATE TABLE IF NOT EXISTS `channel` ( `channel_prvkey` text NOT NULL, `channel_notifyflags` int(10) unsigned NOT NULL DEFAULT '65535', `channel_pageflags` int(10) unsigned NOT NULL DEFAULT '0', - `channel_dirdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `channel_lastpost` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `channel_deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `channel_dirdate` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `channel_lastpost` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `channel_deleted` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `channel_max_anon_mail` int(10) unsigned NOT NULL DEFAULT '10', `channel_max_friend_req` int(10) unsigned NOT NULL DEFAULT '10', `channel_expire_days` int(11) NOT NULL DEFAULT '0', @@ -333,7 +333,7 @@ CREATE TABLE IF NOT EXISTS `chat` ( `chat_room` int(10) unsigned NOT NULL DEFAULT '0', `chat_xchan` char(255) NOT NULL DEFAULT '', `chat_text` mediumtext NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`chat_id`), KEY `chat_room` (`chat_room`), KEY `chat_xchan` (`chat_xchan`), @@ -344,7 +344,7 @@ CREATE TABLE IF NOT EXISTS `chatpresence` ( `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cp_room` int(10) unsigned NOT NULL DEFAULT '0', `cp_xchan` char(255) NOT NULL DEFAULT '', - `cp_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `cp_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `cp_status` char(255) NOT NULL DEFAULT '', `cp_client` char(128) NOT NULL DEFAULT '', PRIMARY KEY (`cp_id`), @@ -359,8 +359,8 @@ CREATE TABLE IF NOT EXISTS `chatroom` ( `cr_aid` int(10) unsigned NOT NULL DEFAULT '0', `cr_uid` int(10) unsigned NOT NULL DEFAULT '0', `cr_name` char(255) NOT NULL DEFAULT '', - `cr_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `cr_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `cr_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `cr_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `cr_expire` int(10) unsigned NOT NULL DEFAULT '0', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, @@ -400,8 +400,8 @@ CREATE TABLE IF NOT EXISTS `conv` ( `recips` mediumtext NOT NULL, `uid` int(11) NOT NULL DEFAULT '0', `creator` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `subject` mediumtext NOT NULL, PRIMARY KEY (`id`), KEY `created` (`created`), @@ -415,7 +415,7 @@ CREATE TABLE IF NOT EXISTS `dreport` ( `dreport_site` char(255) NOT NULL DEFAULT '', `dreport_recip` char(255) NOT NULL DEFAULT '', `dreport_result` char(255) NOT NULL DEFAULT '', - `dreport_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `dreport_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `dreport_xchan` char(255) NOT NULL DEFAULT '', `dreport_queue` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`dreport_id`), @@ -434,10 +434,10 @@ CREATE TABLE IF NOT EXISTS `event` ( `cal_id` int(11) unsigned NOT NULL DEFAULT '0', `event_xchan` char(255) NOT NULL DEFAULT '', `event_hash` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `dtstart` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `dtend` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `dtstart` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `dtend` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `summary` text NOT NULL, `description` text NOT NULL, `location` text NOT NULL, @@ -450,7 +450,7 @@ CREATE TABLE IF NOT EXISTS `event` ( `deny_cid` mediumtext NOT NULL, `deny_gid` mediumtext NOT NULL, `event_status` char(255) NOT NULL DEFAULT '', - `event_status_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `event_status_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `event_percent` smallint(6) NOT NULL DEFAULT '0', `event_repeat` text NOT NULL, `event_sequence` smallint(6) NOT NULL DEFAULT '0', @@ -526,8 +526,8 @@ CREATE TABLE IF NOT EXISTS `hubloc` ( `hubloc_callback` char(255) NOT NULL DEFAULT '', `hubloc_connect` char(255) NOT NULL DEFAULT '', `hubloc_sitekey` text NOT NULL, - `hubloc_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `hubloc_connected` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `hubloc_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `hubloc_connected` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `hubloc_primary` tinyint(1) NOT NULL DEFAULT '0', `hubloc_orphancheck` tinyint(1) NOT NULL DEFAULT '0', `hubloc_error` tinyint(1) NOT NULL DEFAULT '0', @@ -566,8 +566,8 @@ CREATE TABLE IF NOT EXISTS `iconfig` ( CREATE TABLE IF NOT EXISTS `issue` ( `issue_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `issue_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `issue_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `issue_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `issue_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `issue_assigned` char(255) NOT NULL DEFAULT '', `issue_priority` int(11) NOT NULL DEFAULT '0', `issue_status` int(11) NOT NULL DEFAULT '0', @@ -589,13 +589,13 @@ CREATE TABLE IF NOT EXISTS `item` ( `parent` int(10) unsigned NOT NULL DEFAULT '0', `parent_mid` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', `thr_parent` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `comments_closed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `comments_closed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `owner_xchan` char(255) NOT NULL DEFAULT '', `author_xchan` char(255) NOT NULL DEFAULT '', `source_xchan` char(255) NOT NULL DEFAULT '', @@ -771,8 +771,8 @@ CREATE TABLE IF NOT EXISTS `mail` ( `mail_seen` tinyint(4) NOT NULL DEFAULT '0', `mail_recalled` tinyint(4) NOT NULL DEFAULT '0', `mail_obscured` smallint(6) NOT NULL DEFAULT '0', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`id`), KEY `created` (`created`), KEY `mail_flags` (`mail_flags`), @@ -799,8 +799,8 @@ CREATE TABLE IF NOT EXISTS `menu` ( `menu_name` char(255) NOT NULL DEFAULT '', `menu_desc` char(255) NOT NULL DEFAULT '', `menu_flags` int(11) NOT NULL DEFAULT '0', - `menu_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `menu_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `menu_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `menu_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`menu_id`), KEY `menu_channel_id` (`menu_channel_id`), KEY `menu_name` (`menu_name`), @@ -833,7 +833,7 @@ CREATE TABLE IF NOT EXISTS `notify` ( `xname` char(255) NOT NULL DEFAULT '', `url` char(255) NOT NULL DEFAULT '', `photo` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `msg` mediumtext NOT NULL, `aid` int(11) NOT NULL DEFAULT '0', `uid` int(11) NOT NULL DEFAULT '0', @@ -865,8 +865,8 @@ CREATE TABLE IF NOT EXISTS `obj` ( `obj_term` char(255) NOT NULL DEFAULT '', `obj_url` char(255) NOT NULL DEFAULT '', `obj_imgurl` char(255) NOT NULL DEFAULT '', - `obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `obj_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `obj_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `obj_quantity` int(11) NOT NULL DEFAULT '0', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, @@ -894,8 +894,8 @@ CREATE TABLE IF NOT EXISTS `outq` ( `outq_posturl` char(255) NOT NULL DEFAULT '', `outq_async` tinyint(1) NOT NULL DEFAULT '0', `outq_delivered` tinyint(1) NOT NULL DEFAULT '0', - `outq_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `outq_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `outq_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `outq_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `outq_notify` mediumtext NOT NULL, `outq_msg` mediumtext NOT NULL, `outq_priority` smallint(6) NOT NULL DEFAULT '0', @@ -927,8 +927,8 @@ CREATE TABLE IF NOT EXISTS `photo` ( `uid` int(10) unsigned NOT NULL DEFAULT '0', `xchan` char(255) NOT NULL DEFAULT '', `resource_id` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `title` char(255) NOT NULL DEFAULT '', `description` text NOT NULL, `album` char(255) NOT NULL DEFAULT '', @@ -1034,7 +1034,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `gender` char(32) NOT NULL DEFAULT '', `marital` char(255) NOT NULL DEFAULT '', `partner` text NOT NULL, - `howlong` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `sexual` char(255) NOT NULL DEFAULT '', `politic` char(255) NOT NULL DEFAULT '', `religion` char(255) NOT NULL DEFAULT '', @@ -1092,7 +1092,7 @@ CREATE TABLE IF NOT EXISTS `profile_check` ( CREATE TABLE IF NOT EXISTS `register` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hash` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `uid` int(10) unsigned NOT NULL DEFAULT '0', `password` char(255) NOT NULL DEFAULT '', `lang` char(16) NOT NULL DEFAULT '', @@ -1139,9 +1139,9 @@ CREATE TABLE IF NOT EXISTS `site` ( `site_url` char(255) NOT NULL, `site_access` int(11) NOT NULL DEFAULT '0', `site_flags` int(11) NOT NULL DEFAULT '0', - `site_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `site_pull` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `site_sync` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `site_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `site_pull` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `site_sync` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `site_directory` char(255) NOT NULL DEFAULT '', `site_register` int(11) NOT NULL DEFAULT '0', `site_sellpage` char(255) NOT NULL DEFAULT '', @@ -1230,8 +1230,8 @@ CREATE TABLE IF NOT EXISTS `updates` ( `ud_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ud_hash` char(128) NOT NULL DEFAULT '', `ud_guid` char(255) NOT NULL DEFAULT '', - `ud_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `ud_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ud_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `ud_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `ud_flags` int(11) NOT NULL DEFAULT '0', `ud_addr` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`ud_id`), @@ -1249,7 +1249,7 @@ CREATE TABLE IF NOT EXISTS `verify` ( `vtype` char(32) NOT NULL DEFAULT '', `token` char(255) NOT NULL DEFAULT '', `meta` char(255) NOT NULL DEFAULT '', - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`id`), KEY `channel` (`channel`), KEY `vtype` (`vtype`), @@ -1288,8 +1288,8 @@ CREATE TABLE IF NOT EXISTS `xchan` ( `xchan_network` char(255) NOT NULL DEFAULT '', `xchan_instance_url` char(255) NOT NULL DEFAULT '', `xchan_flags` int(10) unsigned NOT NULL DEFAULT '0', - `xchan_photo_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `xchan_name_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `xchan_photo_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `xchan_name_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `xchan_hidden` tinyint(1) NOT NULL DEFAULT '0', `xchan_orphan` tinyint(1) NOT NULL DEFAULT '0', `xchan_censored` tinyint(1) NOT NULL DEFAULT '0', @@ -1321,7 +1321,7 @@ CREATE TABLE IF NOT EXISTS `xchat` ( `xchat_url` char(255) NOT NULL DEFAULT '', `xchat_desc` char(255) NOT NULL DEFAULT '', `xchat_xchan` char(255) NOT NULL DEFAULT '', - `xchat_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `xchat_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`xchat_id`), KEY `xchat_url` (`xchat_url`), KEY `xchat_desc` (`xchat_desc`), @@ -1356,7 +1356,7 @@ CREATE TABLE IF NOT EXISTS `xlink` ( `xlink_link` char(255) NOT NULL DEFAULT '', `xlink_rating` int(11) NOT NULL DEFAULT '0', `xlink_rating_text` text NOT NULL, - `xlink_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `xlink_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `xlink_static` tinyint(1) NOT NULL DEFAULT '0', `xlink_sig` text NOT NULL, PRIMARY KEY (`xlink_id`), diff --git a/install/update.php b/install/update.php index 5e5a25966..921d16e2f 100644 --- a/install/update.php +++ b/install/update.php @@ -54,7 +54,7 @@ function update_r1001() { `type` CHAR( 32 ) NOT NULL DEFAULT '', `token` CHAR( 255 ) NOT NULL DEFAULT '', `meta` CHAR( 255 ) NOT NULL DEFAULT '', - `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY ( `id` ) ) ENGINE = MYISAM DEFAULT CHARSET=utf8"); @@ -92,7 +92,7 @@ function update_r1004() { $r = q("CREATE TABLE if not exists `site` ( `site_url` CHAR( 255 ) NOT NULL , `site_flags` INT NOT NULL DEFAULT '0', -`site_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', +`site_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', `site_directory` CHAR( 255 ) NOT NULL DEFAULT '', PRIMARY KEY ( `site_url` ) ) ENGINE = MYISAM DEFAULT CHARSET=utf8"); @@ -174,7 +174,7 @@ function update_r1009() { function update_r1010() { - $r = q("ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `abook_connnected` , + $r = q("ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `abook_connnected` , ADD INDEX ( `abook_dob` )"); $r2 = q("ALTER TABLE `profile` ADD `dob_tz` CHAR( 255 ) NOT NULL DEFAULT 'UTC' AFTER `dob`"); @@ -185,7 +185,7 @@ ADD INDEX ( `abook_dob` )"); } function update_r1011() { - $r = q("ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` , + $r = q("ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` , ADD INDEX ( `expires` )"); if($r) @@ -207,7 +207,7 @@ function update_r1013() { `xlink_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `xlink_xchan` CHAR( 255 ) NOT NULL DEFAULT '', `xlink_link` CHAR( 255 ) NOT NULL DEFAULT '', -`xlink_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' +`xlink_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' ) ENGINE = MYISAM DEFAULT CHARSET=utf8"); $r2 = q("alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) "); @@ -299,7 +299,7 @@ function update_r1020() { function update_r1021() { - $r = q("ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + $r = q("ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', drop index `abook_connnected`, add index ( `abook_connected` ) "); if($r) @@ -363,7 +363,7 @@ ADD INDEX ( `xlink_rating` ) "); } function update_r1029() { - $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_pageflags` , + $r = q("ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_deleted` ) "); if($r) return UPDATE_SUCCESS; @@ -373,8 +373,8 @@ ADD INDEX ( `channel_deleted` ) "); function update_r1030() { $r = q("CREATE TABLE IF NOT EXISTS `issue` ( `issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`issue_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', -`issue_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', +`issue_created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +`issue_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', `issue_assigned` CHAR( 255 ) NOT NULL , `issue_priority` INT NOT NULL , `issue_status` INT NOT NULL , @@ -440,7 +440,7 @@ KEY `share_xchan` (`share_xchan`) function update_r1034() { $r = q("CREATE TABLE if not exists `updates` ( `ud_hash` CHAR( 128 ) NOT NULL , -`ud_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', +`ud_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY ( `ud_hash` ), KEY `ud_date` ( `ud_date` ) ) ENGINE = MYISAM DEFAULT CHARSET = utf8"); @@ -537,8 +537,8 @@ function update_r1041() { function update_r1042() { - $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', -ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )"); + $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', +ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )"); if($r) return UPDATE_SUCCESS; return UPDATE_FAILED; @@ -846,7 +846,7 @@ function update_r1073() { function update_r1074() { $r1 = q("ALTER TABLE `site` ADD `site_sync` DATETIME NOT NULL AFTER `site_update` "); - $r2 = q("ALTER TABLE `updates` ADD `ud_last` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `ud_date` , + $r2 = q("ALTER TABLE `updates` ADD `ud_last` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `ud_date` , ADD INDEX ( `ud_last` ) "); if($r1 && $r2) @@ -879,7 +879,7 @@ function update_r1077() { } function update_r1078() { - $r = q("ALTER TABLE `channel` ADD `channel_dirdate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_dirdate` )"); + $r = q("ALTER TABLE `channel` ADD `channel_dirdate` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_pageflags` , ADD INDEX ( `channel_dirdate` )"); if($r) return UPDATE_SUCCESS; @@ -894,7 +894,7 @@ function update_r1079() { } function update_r1080() { - $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `expires` ) "); if($r) return UPDATE_SUCCESS; @@ -1010,7 +1010,7 @@ function update_r1092() { `chat_room` int(10) unsigned NOT NULL DEFAULT '0', `chat_xchan` char(255) NOT NULL DEFAULT '', `chat_text` mediumtext NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`chat_id`), KEY `chat_room` (`chat_room`), KEY `chat_xchan` (`chat_xchan`), @@ -1021,7 +1021,7 @@ function update_r1092() { `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cp_room` int(10) unsigned NOT NULL DEFAULT '0', `cp_xchan` char(255) NOT NULL DEFAULT '', - `cp_last` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `cp_last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `cp_status` char(255) NOT NULL, PRIMARY KEY (`cp_id`), KEY `cp_room` (`cp_room`), @@ -1035,8 +1035,8 @@ function update_r1092() { `cr_aid` int(10) unsigned NOT NULL DEFAULT '0', `cr_uid` int(10) unsigned NOT NULL DEFAULT '0', `cr_name` char(255) NOT NULL DEFAULT '', - `cr_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `cr_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `cr_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `cr_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, @@ -1141,7 +1141,7 @@ function update_r1099() { } function update_r1100() { - $r = q("ALTER TABLE `xchat` ADD `xchat_edited` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + $r = q("ALTER TABLE `xchat` ADD `xchat_edited` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `xchat_edited` ) "); if($r) return UPDATE_SUCCESS; @@ -1179,8 +1179,8 @@ function update_r1104() { } function update_r1105() { - $r = q("ALTER TABLE `site` ADD `site_pull` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `site_update` , -CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', ADD INDEX ( `site_pull` ) "); + $r = q("ALTER TABLE `site` ADD `site_pull` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `site_update` , +CHANGE `site_sync` `site_sync` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `site_pull` ) "); if($r) return UPDATE_SUCCESS; return UPDATE_FAILED; @@ -1319,7 +1319,7 @@ DROP INDEX `channel_a_bookmark` , ADD INDEX `channel_w_like` ( `channel_w_like` } function update_r1118() { - $r = q("ALTER TABLE `account` ADD `account_password_changed` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + $r = q("ALTER TABLE `account` ADD `account_password_changed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( `account_password_changed` )"); if($r) return UPDATE_SUCCESS; @@ -1411,8 +1411,8 @@ function update_r1124() { `recips` mediumtext NOT NULL, `uid` int(11) NOT NULL, `creator` char(255) NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', + `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `subject` mediumtext NOT NULL, PRIMARY KEY (`id`), KEY `created` (`created`), @@ -1445,7 +1445,7 @@ ADD INDEX ( `convid` )"); } function update_r1127() { - $r = q("ALTER TABLE `item` ADD `comments_closed` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `changed` , + $r = q("ALTER TABLE `item` ADD `comments_closed` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `changed` , ADD INDEX ( `comments_closed` ), ADD INDEX ( `changed` ) "); if($r) return UPDATE_SUCCESS; @@ -1597,7 +1597,7 @@ function update_r1139() { $r = $r1 && $r2; } else - $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) "); + $r = q("ALTER TABLE `channel` ADD `channel_lastpost` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `channel_dirdate` , ADD INDEX ( `channel_lastpost` ) "); if($r) return UPDATE_SUCCESS; return UPDATE_FAILED; @@ -1632,7 +1632,7 @@ function update_r1141() { $r = $r1 && $r2; } else - $r = q("ALTER TABLE menu ADD menu_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', ADD menu_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', ADD INDEX ( menu_created ), ADD INDEX ( menu_edited ) "); + $r = q("ALTER TABLE menu ADD menu_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD menu_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD INDEX ( menu_created ), ADD INDEX ( menu_edited ) "); $t = datetime_convert(); q("update menu set menu_created = '%s', menu_edited = '%s' where true", @@ -1700,7 +1700,7 @@ function update_r1145() { } else { $r = q("ALTER TABLE `event` ADD `event_status` CHAR( 255 ) NOT NULL DEFAULT '', - ADD `event_status_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + ADD `event_status_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', ADD `event_percent` SMALLINT NOT NULL DEFAULT '0', ADD `event_repeat` TEXT NOT NULL DEFAULT '', ADD INDEX ( `event_status` ) "); @@ -1751,8 +1751,8 @@ function update_r1149() { $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', - ADD obj_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - ADD obj_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + ADD obj_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD obj_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); } $r2 = q("create index obj_term on obj ( obj_term ) "); @@ -1774,8 +1774,8 @@ function update_r1150() { ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); } else { - $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - ADD app_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD app_edited DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); } $r2 = q("create index app_created on app ( app_created ) "); @@ -1837,7 +1837,7 @@ function update_r1152() { `dreport_site` char(255) NOT NULL DEFAULT '', `dreport_recip` char(255) NOT NULL DEFAULT '', `dreport_result` char(255) NOT NULL DEFAULT '', - `dreport_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `dreport_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', `dreport_xchan` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`dreport_id`), KEY `dreport_mid` (`dreport_mid`), @@ -2197,7 +2197,7 @@ function update_r1173() { } else { $r1 = q("ALTER TABLE notify CHANGE `name` `xname` char(255) NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + $r2 = q("ALTER TABLE notify CHANGE `date` `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); $r3 = q("ALTER TABLE notify CHANGE `type` `ntype` smallint(3) NOT NULL DEFAULT '0' "); } @@ -2219,8 +2219,8 @@ function update_r1174() { } else { $r1 = q("ALTER TABLE event CHANGE `type` `etype` char(255) NOT NULL DEFAULT '' "); - $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); - $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + $r2 = q("ALTER TABLE event CHANGE `start` `dtstart` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); + $r3 = q("ALTER TABLE event CHANGE `finish` `dtend` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' "); $r4 = q("ALTER TABLE event CHANGE `ignore` `dismissed` tinyint(1) NOT NULL DEFAULT '0' "); $r5 = q("ALTER TABLE attach CHANGE `data` `content` longblob NOT NULL "); $r6 = q("ALTER TABLE photo CHANGE `data` `content` mediumblob NOT NULL "); @@ -2389,7 +2389,7 @@ function update_r1179() { `atoken_uid` int(11) NOT NULL DEFAULT 0, `atoken_name` char(255) NOT NULL DEFAULT '', `atoken_token` char(255) NOT NULL DEFAULT '', - `atoken_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `atoken_expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY (`atoken_id`), KEY `atoken_aid` (`atoken_aid`), KEY `atoken_uid` (`atoken_uid`), |