]> git.mxchange.org Git - friendica.git/blobdiff - update.php
Merge remote-tracking branch 'upstream/develop' into 1702-null-date
[friendica.git] / update.php
index 0679b5a1f8295ce028e3b8b1f7d35117f0dd026a..b15f7b099f71903a7af909754c86783250aedd8c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define('UPDATE_VERSION' , 1209);
+define('UPDATE_VERSION' , 1215);
 
 /**
  *
@@ -48,8 +48,8 @@ function update_1000() {
 
        q("ALTER TABLE `intro` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `knowyou` ");
        q("ALTER TABLE `contact` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rel` ");
-       q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
-       q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar-date`");
+       q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXTCHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
+       q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `avatar-date`");
 }
 
 function update_1001() {
@@ -86,7 +86,7 @@ function update_1006() {
 
        $r = q("SELECT * FROM `user` WHERE `spubkey` = '' ");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $sres=openssl_pkey_new(array('encrypt_key' => false ));
                        $sprvkey = '';
                        openssl_pkey_export($sres, $sprvkey);
@@ -123,7 +123,7 @@ function update_1011() {
        q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
        $r = q("SELECT * FROM `contact` WHERE 1");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                                q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d",
                                        dbesc(basename($rr['url'])),
                                        intval($rr['id'])
@@ -146,7 +146,7 @@ function update_1014() {
        q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
        $r = q("SELECT * FROM `photo` WHERE `scale` = 4");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $ph = new Photo($rr['data']);
                        if($ph->is_valid()) {
                                $ph->scaleImage(48);
@@ -156,7 +156,7 @@ function update_1014() {
        }
        $r = q("SELECT * FROM `contact` WHERE 1");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        if(stristr($rr['thumb'],'avatar'))
                                q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
                                        dbesc(str_replace('avatar','micro',$rr['thumb'])),
@@ -242,8 +242,8 @@ function update_1022() {
 }
 
 function update_1023() {
-       q("ALTER TABLE `user` ADD `register_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `timezone` ,
-       ADD `login_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `register_date` ");
+       q("ALTER TABLE `user` ADD `register_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `timezone` ,
+       ADD `login_date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `register_date` ");
 }
 
 function update_1024() {
@@ -309,7 +309,7 @@ function update_1031() {
        // Repair any bad links that slipped into the item table
        $r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' ");
        if($r && dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        if(strstr($rr['object'],'type=&quot;http')) {
                                q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d",
                                        dbesc(str_replace('type=&quot;http','href=&quot;http',$rr['object'])),
@@ -349,7 +349,7 @@ function update_1034() {
 
 function update_1035() {
 
-       q("ALTER TABLE `contact` ADD `success_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `last-update` ");
+       q("ALTER TABLE `contact` ADD `success_update` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `last-update` ");
 
 }
 
@@ -357,7 +357,7 @@ function update_1036() {
 
        $r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' ");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
                                dbesc(str_replace('include/photo','photo',$rr['photo'])),
                                dbesc(str_replace('include/photo','photo',$rr['thumb'])),
@@ -443,7 +443,7 @@ function update_1049() {
        `user` CHAR( 255 ) NOT NULL ,
        `pass` CHAR( 255 ) NOT NULL ,
        `reply_to` CHAR( 255 ) NOT NULL ,
-       `last_check` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
+       `last_check` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00'
        ) ENGINE = MYISAM ");
 }
 
@@ -454,8 +454,8 @@ function update_1050() {
        `filetype` CHAR( 64 ) NOT NULL ,
        `filesize` INT NOT NULL ,
        `data` 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 ,
@@ -531,7 +531,7 @@ function update_1065() {
 }
 
 function update_1066() {
-       $r = q("ALTER TABLE `item` ADD `received` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
+       $r = q("ALTER TABLE `item` ADD `received` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` ");
        if($r)
                q("ALTER TABLE `item` ADD INDEX ( `received` ) ");
 
@@ -607,7 +607,7 @@ function update_1075() {
        q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` ");
        $r = q("SELECT `uid` FROM `user` WHERE 1");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $found = true;
                        do {
                                $guid = substr(random_string(),0,16);
@@ -673,7 +673,7 @@ function update_1079() {
 }
 
 function update_1080() {
-       q("ALTER TABLE `fcontact` ADD `updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
+       q("ALTER TABLE `fcontact` ADD `updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00'");
 }
 
 function update_1081() {
@@ -689,7 +689,7 @@ function update_1082() {
                return;
        $r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $guid = get_guid();
                        q("update `photo` set `guid` = '%s' where `resource-id` = '%s'",
                                dbesc($guid),
@@ -728,11 +728,11 @@ function update_1086() {
 }
 
 function update_1087() {
-       q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
+       q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `edited` ");
 
        $r = q("SELECT `id` FROM `item` WHERE `parent` = `id` ");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1",
                                intval($rr['id'])
                        );
@@ -747,8 +747,8 @@ function update_1087() {
 
 function update_1088() {
        q("ALTER TABLE `user` ADD `account_expired` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `expire` ,
-               ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expired` ,
-               ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expires_on` ");
+               ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `account_expired` ,
+               ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `account_expires_on` ");
 }
 
 function update_1089() {
@@ -855,7 +855,7 @@ function update_1100() {
 
        $r = q("select id, url from contact where url != '' and nurl = '' ");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        q("update contact set nurl = '%s' where id = %d",
                                dbesc(normalise_link($rr['url'])),
                                intval($rr['id'])
@@ -932,8 +932,8 @@ ADD INDEX ( `hidden` ) ");
 
 function update_1109() {
        q("ALTER TABLE `conv` ADD `creator` CHAR( 255 ) NOT NULL ,
-               ADD `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
-               ADD `updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+               ADD `created` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
+               ADD `updated` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00',
                ADD `subject` MEDIUMTEXT NOT NULL,
                ADD INDEX ( `created` ), ADD INDEX ( `updated` ) ");
 }
@@ -1112,7 +1112,7 @@ function update_1127() {
 
 
 function update_1128() {
-       q("alter table spam add `date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `term` ");
+       q("alter table spam add `date` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `term` ");
 }
 
 function update_1129() {
@@ -1169,7 +1169,7 @@ function update_1136() {
 
        $r = q("select * from config where 1 order by id desc");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $found = false;
                        foreach($arr as $x) {
                                if($x['cat'] == $rr['cat'] && $x['k'] == $rr['k']) {
@@ -1188,7 +1188,7 @@ function update_1136() {
        $arr = array();
        $r = q("select * from pconfig where 1 order by id desc");
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $found = false;
                        foreach($arr as $x) {
                                if($x['uid'] == $rr['uid'] && $x['cat'] == $rr['cat'] && $x['k'] == $rr['k']) {
@@ -1262,7 +1262,7 @@ function update_1144() {
 }
 
 function update_1145() {
-       $r = q("alter table profile add howlong datetime not null default '0000-00-00 00:00:00' after `with`");
+       $r = q("alter table profile add howlong datetime not null default '0001-01-01 00:00:00' after `with`");
        if(! $r)
                return UPDATE_FAILED ;
        return UPDATE_SUCCESS ;
@@ -1562,11 +1562,11 @@ function update_1169() {
                  `iid` int(10) unsigned NOT NULL DEFAULT '0',
                  `uid` int(10) unsigned NOT NULL DEFAULT '0',
                  `contact-id` int(11) unsigned NOT NULL DEFAULT '0',
-                 `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
-                 `edited` 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',
+                 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
+                 `edited` 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',
                  `wall` tinyint(1) NOT NULL DEFAULT '0',
                  `private` tinyint(1) NOT NULL DEFAULT '0',
                  `pubmail` tinyint(1) NOT NULL DEFAULT '0',