]> git.mxchange.org Git - friendica.git/blobdiff - update.php
clean up some regex's for i18n, and eliminate old ereg patterns.
[friendica.git] / update.php
index 9f122f53e0e2d854538a59c753512f84af41de10..eb3231b5693c04c31ba8a3d1f01805b141b53dc7 100644 (file)
@@ -74,5 +74,63 @@ function update_1008() {
 }
 
 function update_1009() {
-       q("ALTER TABLE `user` ADD `allow_location` TINYINT( 1 ) NOT NULL AFTER `default-location` ");
+       q("ALTER TABLE `user` ADD `allow_location` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `default-location` ");
+}
+
+function update_1010() {
+       q("ALTER TABLE `contact` ADD `lrdd` CHAR( 255 ) NOT NULL AFTER `url` ");
+}
+
+function update_1011() {
+       q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
+       $r = q("SELECT * FROM `contact` WHERE 1");
+       if(count($r)) {
+               foreach($r as $rr) {
+                               q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d LIMIT 1",
+                                       dbesc(basename($rr['url'])),
+                                       intval($rr['id'])
+                               );
+               }
+       }
+}
+
+function update_1012() {
+       q("ALTER TABLE `item` ADD `inform` MEDIUMTEXT NOT NULL AFTER `tag` ");
+}
+
+function update_1013() {
+       q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL 
+               AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`");
+} 
+
+function update_1014() {
+       require_once('include/Photo.php');
+       q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
+       $r = q("SELECT * FROM `photo` WHERE `scale` = 4");
+       if(count($r)) {
+               foreach($r as $rr) {
+                       $ph = new Photo($rr['data']);
+                       if($ph->is_valid()) {
+                               $ph->scaleImage(48);
+                               $ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
+                       }
+               }
+       }
+       $r = q("SELECT * FROM `contact` WHERE 1");
+       if(count($r)) {
+               foreach($r as $rr) {            
+                       if(stristr($rr['thumb'],'avatar'))
+                               q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d LIMIT 1",
+                                       dbesc(str_replace('avatar','micro',$rr['thumb'])),
+                                       intval($rr['id']));
+                       else
+                               q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d LIMIT 1",
+                                       dbesc(str_replace('5.jpg','6.jpg',$rr['thumb'])),
+                                       intval($rr['id']));
+               }
+       }
+}
+
+function update_1015() {
+       q("ALTER TABLE `item` CHANGE `body` `body` mediumtext NOT NULL");
 }
\ No newline at end of file