X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=041de9cfff4b2acc1d85f822a94f25bac939bd95;hb=21cad46d19f4a049b9d4d69a0a569e023c652b6d;hp=76007ad3aa0d3ac9860ea68a81c6c49303db2832;hpb=4eeb5a0a17fd394d27faf0315196d6916a22d31b;p=friendica.git diff --git a/update.php b/update.php index 76007ad3aa..041de9cfff 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ false )); $sprvkey = ''; openssl_pkey_export($sres, $sprvkey); @@ -122,8 +122,8 @@ function update_1010() { 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) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d", dbesc(basename($rr['url'])), intval($rr['id']) @@ -145,8 +145,8 @@ 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) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { $ph = new Photo($rr['data']); if($ph->is_valid()) { $ph->scaleImage(48); @@ -155,8 +155,8 @@ function update_1014() { } } $r = q("SELECT * FROM `contact` WHERE 1"); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + 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'])), @@ -308,8 +308,8 @@ function update_1030() { function update_1031() { // Repair any bad links that slipped into the item table $r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' "); - if($r && count($r)) { - foreach($r as $rr) { + if($r && dbm::is_result($r)) { + foreach ($r as $rr) { if(strstr($rr['object'],'type="http')) { q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d", dbesc(str_replace('type="http','href="http',$rr['object'])), @@ -356,8 +356,8 @@ function update_1035() { function update_1036() { $r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' "); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + 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'])), @@ -594,7 +594,7 @@ function update_1073() { function update_1074() { q("ALTER TABLE `user` ADD `hidewall` TINYINT( 1) NOT NULL DEFAULT '0' AFTER `blockwall` "); $r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1"); - if(count($r)) { + if (dbm::is_result($r)) { foreach($r as $rr) q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d", intval($rr['uid']) @@ -606,8 +606,8 @@ function update_1074() { function update_1075() { q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` "); $r = q("SELECT `uid` FROM `user` WHERE 1"); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { $found = true; do { $guid = substr(random_string(),0,16); @@ -685,11 +685,11 @@ function update_1082() { ADD INDEX ( `guid` ) "); // make certain the following code is only executed once $r = q("select `id` from `photo` where `guid` != '' limit 1"); - if($r && count($r)) + if (dbm::is_result($r)) return; $r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`"); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { $guid = get_guid(); q("update `photo` set `guid` = '%s' where `resource-id` = '%s'", dbesc($guid), @@ -731,8 +731,8 @@ function update_1087() { q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` "); $r = q("SELECT `id` FROM `item` WHERE `parent` = `id` "); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { $x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1", intval($rr['id']) ); @@ -854,8 +854,8 @@ function update_1100() { require_once('include/text.php'); $r = q("select id, url from contact where url != '' and nurl = '' "); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { q("update contact set nurl = '%s' where id = %d", dbesc(normalise_link($rr['url'])), intval($rr['id']) @@ -1030,7 +1030,7 @@ function update_1120() { // might be missing on new installs. We'll check. $r = q("describe item"); - if($r && count($r)) { + if (dbm::is_result($r)) { foreach($r as $rr) if($rr['Field'] == 'spam') return; @@ -1168,8 +1168,8 @@ function update_1136() { // order in reverse so that we save the newest entry $r = q("select * from config where 1 order by id desc"); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { $found = false; foreach($arr as $x) { if($x['cat'] == $rr['cat'] && $x['k'] == $rr['k']) { @@ -1187,8 +1187,8 @@ function update_1136() { $arr = array(); $r = q("select * from pconfig where 1 order by id desc"); - if(count($r)) { - foreach($r as $rr) { + if (dbm::is_result($r)) { + foreach ($r as $rr) { $found = false; foreach($arr as $x) { if($x['uid'] == $rr['uid'] && $x['cat'] == $rr['cat'] && $x['k'] == $rr['k']) { @@ -1692,7 +1692,7 @@ function update_1190() { ); // convert old forumlist addon entries in new config entries - if (count($r)) { + if (dbm::is_result($r)) { foreach ($r as $rr) { $uid = $rr['uid']; $family = $rr['cat'];