diff --git a/README.md b/README.md index c579c02..cf272b2 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ New features in this version compared to the original 0.5 * Very simple CSS-based mobile view * Tables are using InnoDB, UTF-8 encoding, and foreign keys * Code is cleaned of PHP warnings/notices and compatible with PHP 5.4+ +* PHP mysqli extension is used instead of deprecated mysql TODO ---- @@ -45,7 +46,7 @@ Requirements ------------ * A web server running PHP 5 or later (nginx + php5-fpm or Apache). -* PHP extensions: mysql/mysqlnd, XML, PCRE, cURL, Zlib, mbstring, iconv. +* PHP extensions: mysqli/mysqlnd, XML, PCRE, cURL, Zlib, mbstring, iconv. * MariaDB/MySQL 5 or later. MariaDB 5.5 or later with Barracuda storage format (innodb_file_format = barracuda) is recommended. diff --git a/classes/fof-prefs.php b/classes/fof-prefs.php index 27cde9f..be62195 100644 --- a/classes/fof-prefs.php +++ b/classes/fof-prefs.php @@ -25,7 +25,7 @@ class FoF_Prefs $this->user_id = $user_id; $result = fof_safe_query("select user_prefs from $FOF_USER_TABLE where user_id = %d", $user_id); - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); $prefs = unserialize($row['user_prefs']); if(!is_array($prefs)) $prefs = array(); @@ -34,7 +34,7 @@ class FoF_Prefs if($user_id != 1) { $result = fof_safe_query("select user_prefs from $FOF_USER_TABLE where user_id = 1"); - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); $admin_prefs = unserialize($row['user_prefs']); if(!is_array($admin_prefs)) $admin_prefs = array(); $this->admin_prefs = $admin_prefs; diff --git a/fof-db.php b/fof-db.php index ff9cbf0..e78f382 100644 --- a/fof-db.php +++ b/fof-db.php @@ -24,9 +24,8 @@ $FOF_USER_TABLE = FOF_USER_TABLE; function fof_db_connect() { global $fof_connection; - - $fof_connection = mysql_pconnect(FOF_DB_HOST, FOF_DB_USER, FOF_DB_PASS) or die("

Cannot connect to database. Please update configuration in fof-config.php. Mysql says: " . mysql_error() . ""); - mysql_select_db(FOF_DB_DBNAME, $fof_connection) or die("

Cannot select database. Please update configuration in fof-config.php. Mysql says: " . mysql_error() . ""); + $fof_connection = mysqli_connect('p:'.FOF_DB_HOST, FOF_DB_USER, FOF_DB_PASS, FOF_DB_DBNAME) + or die("

Cannot connect to database. Please update configuration in fof-config.php. MySQL says: " . mysqli_connect_error() . ""); fof_db_query("SET NAMES utf8"); } @@ -39,12 +38,14 @@ function fof_db_optimize() function fof_safe_query(/* $query, [$args...]*/) { - $args = func_get_args(); + global $fof_connection; + $args = func_get_args(); $query = array_shift($args); - if(isset($args[0]) && is_array($args[0])) $args = $args[0]; - $args = array_map('mysql_real_escape_string', $args); + if (isset($args[0]) && is_array($args[0])) + $args = $args[0]; + foreach ($args as &$a) + $a = $fof_connection->real_escape_string($a); $query = vsprintf($query, $args); - return fof_db_query($query); } @@ -55,11 +56,13 @@ function fof_db_query($sql, $live=0) list($usec, $sec) = explode(" ", microtime()); $t1 = (float)$sec + (float)$usec; - $result = mysql_query($sql, $fof_connection); + $result = $fof_connection->query($sql); $num = $affected = 0; - if(is_resource($result)) $num = mysql_num_rows($result); - if($result) $affected = mysql_affected_rows($fof_connection); + if (is_object($result)) + $num = $result->num_rows; + if ($result) + $affected = $fof_connection->affected_rows; list($usec, $sec) = explode(" ", microtime()); $t2 = (float)$sec + (float)$usec; @@ -67,18 +70,29 @@ function fof_db_query($sql, $live=0) $logmessage = sprintf("%.3f: [%s] (%d / %d)", $elapsed, $sql, $num, $affected); fof_log($logmessage, "query"); - if($live) + if ($live) { return $result; } else { - if(mysql_errno($fof_connection)) - fof_die_mysql_error("Cannot run query '$sql': ".mysql_errno($fof_connection).": ".mysql_error($fof_connection)); + if ($fof_connection->errno) + fof_die_mysql_error("Cannot run query '$sql': ".$fof_connection->errno.": ".$fof_connection->error); return $result; } } +function fof_num_rows($result) +{ + return $result ? $result->num_rows : 0; +} + +function fof_insert_id() +{ + global $fof_connection; + return $fof_connection->insert_id; +} + function fof_die_mysql_error($error) { ob_start(); @@ -93,7 +107,7 @@ function fof_die_mysql_error($error) function fof_db_get_row($result) { - return mysql_fetch_array($result); + return $result->fetch_assoc(); } function fof_db_get_value($sql) @@ -101,7 +115,7 @@ function fof_db_get_value($sql) if (!($result = fof_db_query($sql)) || !($row = fof_db_get_row($result))) return NULL; - return $row[0]; + return reset($row); } //////////////////////////////////////////////////////////////////////////////// @@ -214,10 +228,8 @@ function fof_db_is_subscribed($user_id, $feed_url) $result = fof_safe_query("select $FOF_SUBSCRIPTION_TABLE.feed_id from $FOF_FEED_TABLE, $FOF_SUBSCRIPTION_TABLE where feed_url='%s' and $FOF_SUBSCRIPTION_TABLE.feed_id = $FOF_FEED_TABLE.feed_id and $FOF_SUBSCRIPTION_TABLE.user_id = %d", $feed_url, $user_id); - if(mysql_num_rows($result) == 0) - { + if (fof_num_rows($result) == 0) return false; - } return true; } @@ -228,12 +240,7 @@ function fof_db_get_feed_by_url($feed_url) $result = fof_safe_query("select * from $FOF_FEED_TABLE where feed_url='%s'", $feed_url); - if (mysql_num_rows($result) == 0) - return NULL; - - $row = mysql_fetch_array($result); - - return $row; + return fof_db_get_row($result); } function fof_db_get_feed_by_id($feed_id, $user_id = false) @@ -245,12 +252,7 @@ function fof_db_get_feed_by_id($feed_id, $user_id = false) $j = "JOIN $FOF_SUBSCRIPTION_TABLE s ON s.user_id=".intval($user_id)." AND s.feed_id=s.feed_id"; $result = fof_safe_query("select * from $FOF_FEED_TABLE f $j where f.feed_id=%d", $feed_id); - if (mysql_num_rows($result) == 0) - return NULL; - - $row = mysql_fetch_array($result); - - return $row; + return fof_db_get_row($result); } function fof_db_add_feed($url, $title, $link, $description) @@ -259,7 +261,7 @@ function fof_db_add_feed($url, $title, $link, $description) fof_safe_query("insert into $FOF_FEED_TABLE (feed_url,feed_title,feed_link,feed_description) values ('%s', '%s', '%s', '%s')", $url, $title, $link, $description); - return mysql_insert_id($fof_connection); + return fof_insert_id(); } function fof_db_add_subscription($user_id, $feed_id) @@ -298,12 +300,9 @@ function fof_db_find_item($feed_id, $item_guid) global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $fof_connection; $result = fof_safe_query("select item_id from $FOF_ITEM_TABLE where feed_id=%d and item_guid='%s'", $feed_id, $item_guid); - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); - if (mysql_num_rows($result) == 0) - return NULL; - else - return($row['item_id']); + return $row ? $row['item_id'] : NULL; } $fof_db_item_fields = array('item_guid', 'item_link', 'item_title', 'item_author', 'item_content', 'item_cached', 'item_published', 'item_updated'); @@ -311,13 +310,17 @@ function fof_db_add_item($feed_id, $item) { global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_SUBSCRIPTION_TABLE, $fof_connection, $fof_db_item_fields; + $args = array(); $sql = "insert into $FOF_ITEM_TABLE (feed_id, ".implode(",", $fof_db_item_fields).") values (".intval($feed_id); foreach ($fof_db_item_fields as $k) - $sql .= ", '".mysql_real_escape_string($item[$k])."'"; + { + $sql .= ", '%s'"; + $args[] = $item[$k]; + } $sql .= ")"; - fof_db_query($sql); + fof_safe_query($sql, $args); - return mysql_insert_id($fof_connection); + return fof_insert_id(); } function fof_db_get_items($user_id = 1, $feed = NULL, $what = "unread", @@ -409,10 +412,10 @@ function fof_db_get_items($user_id = 1, $feed = NULL, $what = "unread", $query = "$select FROM $from $where $order_by"; $result = fof_safe_query($query, $args); - if (mysql_num_rows($result) == 0) + if (fof_num_rows($result) == 0) return array(); - while ($row = mysql_fetch_assoc($result)) + while ($row = fof_db_get_row($result)) { $row['prefs'] = unserialize($row['subscription_prefs']); $array[] = $row; @@ -452,7 +455,7 @@ function fof_db_get_item($user_id, $item_id) $result = fof_safe_query($query, $item_id); - $item = mysql_fetch_assoc($result); + $item = fof_db_get_row($result); $item['tags'] = array(); if ($user_id) { @@ -575,7 +578,7 @@ function fof_db_item_has_tags($item_id) global $FOF_ITEM_TAG_TABLE; $result = fof_safe_query("select count(*) as \"count\" from $FOF_ITEM_TAG_TABLE where item_id=%d and tag_id > 2", $item_id); - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); return $row["count"]; } @@ -585,7 +588,7 @@ function fof_db_get_unread_count($user_id) global $FOF_ITEM_TAG_TABLE; $result = fof_safe_query("select count(*) as \"count\" from $FOF_ITEM_TAG_TABLE where tag_id = 1 and user_id = %d", $user_id); - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); return $row["count"]; } @@ -600,10 +603,8 @@ function fof_db_get_tag_unread($user_id) ); $counts = array(); - while($row = fof_db_get_row($result)) - { + while ($row = fof_db_get_row($result)) $counts[$row['tag_id']] = $row['count']; - } return $counts; } @@ -614,9 +615,7 @@ function fof_db_get_tags($user_id) static $cache = array(); if (isset($cache[$user_id])) - { return $cache[$user_id]; - } $sql = "SELECT $FOF_TAG_TABLE.tag_id, $FOF_TAG_TABLE.tag_name, count($FOF_ITEM_TAG_TABLE.item_id) as count FROM $FOF_TAG_TABLE @@ -627,12 +626,9 @@ function fof_db_get_tags($user_id) $result = fof_safe_query($sql, $user_id); $tags = array(); while ($row = fof_db_get_row($result)) - { $tags[$row['tag_id']] = $row; - } $cache[$user_id] = $tags; - return $tags; } @@ -640,16 +636,11 @@ function fof_db_get_tag_id_map() { global $FOF_TAG_TABLE; - $sql = "select * from $FOF_TAG_TABLE"; - - $result = fof_safe_query($sql); + $result = fof_safe_query("select * from $FOF_TAG_TABLE"); $tags = array(); - - while($row = fof_db_get_row($result)) - { + while ($row = fof_db_get_row($result)) $tags[$row['tag_id']] = $row['tag_name']; - } return $tags; } @@ -660,7 +651,7 @@ function fof_db_create_tag($user_id, $tag) fof_safe_query("insert into $FOF_TAG_TABLE (tag_name) values ('%s')", $tag); - return(mysql_insert_id($fof_connection)); + return fof_insert_id(); } function fof_db_get_tag_by_name($user_id, $tag) @@ -669,14 +660,9 @@ function fof_db_get_tag_by_name($user_id, $tag) $result = fof_safe_query("select $FOF_TAG_TABLE.tag_id from $FOF_TAG_TABLE where $FOF_TAG_TABLE.tag_name = '%s'", $tag); - if(mysql_num_rows($result) == 0) - { - return NULL; - } + $row = fof_db_get_row($result); - $row = mysql_fetch_array($result); - - return $row['tag_id']; + return $row ? $row['tag_id'] : NULL; } function fof_db_mark_unread($user_id, $items) @@ -807,7 +793,7 @@ function fof_db_get_user($username, $userid = NULL) $result = fof_safe_query("select * from $FOF_USER_TABLE where user_id = %d", $userid); else $result = fof_safe_query("select * from $FOF_USER_TABLE where user_name = '%s'", $username); - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); return $row; } @@ -864,10 +850,10 @@ function fof_db_authenticate($user_name, $user_password_hash) $result = fof_safe_query("select * from $FOF_USER_TABLE where user_name = '%s' and user_password_hash = '%s'", $user_name, $user_password_hash); - if (mysql_num_rows($result) == 0) + if (fof_num_rows($result) == 0) return false; - $row = mysql_fetch_array($result); + $row = fof_db_get_row($result); fof_set_current_user($row); @@ -889,8 +875,8 @@ function fof_db_get_is_duplicate_item($item_id, $item_guid, $content_md5) " WHERE item_id IN (".join(",",$dups).") AND $FOF_SUBSCRIPTION_TABLE.feed_id=$FOF_ITEM_TABLE.feed_id" ); $users = array(); - while ($row = mysql_fetch_row($result)) - $users[] = $row[0]; + while ($row = fof_db_get_row($result)) + $users[] = reset($row); return $users; } @@ -921,7 +907,7 @@ function fof_db_get_top_readers($days, $count = NULL) group by u.user_id order by posts desc ".(!is_null($count) ? "limit $count" : "")); $readers = array(); - while ($row = mysql_fetch_assoc($result)) + while ($row = fof_db_get_row($result)) $readers[] = $row; return $readers; } @@ -936,7 +922,7 @@ function fof_db_get_most_popular_feeds($count = NULL) group by f.feed_id having readers>1 order by readers desc ".(!is_null($count) ? "limit $count" : "")); $feeds = array(); - while ($row = mysql_fetch_assoc($result)) + while ($row = fof_db_get_row($result)) $feeds[] = $row; return $feeds; } @@ -944,11 +930,11 @@ function fof_db_get_most_popular_feeds($count = NULL) function fof_db_get_feed_single_user($id) { global $FOF_SUBSCRIPTION_TABLE; - $result = fof_safe_query("SELECT user_id, COUNT(user_id) FROM $FOF_SUBSCRIPTION_TABLE WHERE feed_id=%d GROUP BY feed_id", $id); - $row = mysql_fetch_row($result); - if (!$row || $row[1] > 1) + $result = fof_safe_query("SELECT user_id, COUNT(user_id) n FROM $FOF_SUBSCRIPTION_TABLE WHERE feed_id=%d GROUP BY feed_id", $id); + $row = fof_db_get_row($result); + if (!$row || $row['n'] > 1) return NULL; - return $row[0]; + return $row['user_id']; } function fof_cache_fn($key) diff --git a/fof-main.php b/fof-main.php index 2c56c61..805710f 100644 --- a/fof-main.php +++ b/fof-main.php @@ -476,7 +476,7 @@ function fof_delete_subscription($user_id, $feed_id) { fof_db_delete_subscription($user_id, $feed_id); - if(mysql_num_rows(fof_db_get_subscribed_users($feed_id)) == 0) + if (fof_num_rows(fof_db_get_subscribed_users($feed_id)) == 0) { fof_db_delete_feed($feed_id); } diff --git a/install.php b/install.php index ab36e4b..1a9bf84 100644 --- a/install.php +++ b/install.php @@ -34,7 +34,7 @@ function get_curl_version() $php_ok = (function_exists('version_compare') && version_compare(phpversion(), '4.3.2', '>=')); $xml_ok = extension_loaded('xml'); $pcre_ok = extension_loaded('pcre'); -$mysql_ok = extension_loaded('mysql'); +$mysql_ok = extension_loaded('mysqli'); $curl_ok = (extension_loaded('curl') && version_compare(get_curl_version(), '7.10.5', '>=')); $zlib_ok = extension_loaded('zlib'); @@ -126,7 +126,7 @@ else if($mysql_ok) echo "MySQL ok... "; else { - echo "
Your PHP installation is missing the MySQL extension! This is required by Feed on Feeds. Sorry!"; + echo "
Your PHP installation is missing the MySQLi extension! This is required by Feed on Feeds. Sorry!"; echo ""; exit; } @@ -248,8 +248,7 @@ CREATE TABLE IF NOT EXISTS `$FOF_SUBSCRIPTION_TABLE` ( EOQ; foreach($tables as $table) - if(!fof_db_query($table, 1)) - exit("Can't create table. MySQL says: " . mysql_error() . "
"); + fof_db_query($table, 1); ?> Tables exist.
@@ -259,87 +258,82 @@ Upgrading schema... function add_fk($show_create_table, $table, $column, $ref_table, $action = 'on delete cascade on update cascade') { - if (!strpos($show_create_table, "FOREIGN KEY (`$column`)") && - !fof_db_query("alter table $table add foreign key ($column) references $ref_table ($column) $action")) - exit("Can't add foreign key on $table.$column. MySQL says: " . mysql_error() . "
"); + if (!strpos($show_create_table, "FOREIGN KEY (`$column`)")) + fof_db_query("alter table $table add foreign key ($column) references $ref_table ($column) $action"); } $r = fof_db_query("show table status"); -while ($row = mysql_fetch_assoc($r)) +while ($row = fof_db_get_row($r)) { $table = $row['Name']; $alter = array(); if (strtolower($row['Engine']) === 'myisam') - { $alter[] = 'engine=innodb'; - } if (strpos($row['Collation'], 'utf8') === false) - { $alter[] = 'convert to character set utf8 collate utf8_unicode_ci'; - } $r2 = fof_db_query("desc $table"); - while ($row2 = mysql_fetch_assoc($r2)) - { + while ($row2 = fof_db_get_row($r2)) if (strtolower($row2['Type']) == 'mediumtext') - { $alter[] = 'change '.$row2['Field'].' '.$row2['Field'].' text'.(strtolower($row2['Null']) == 'no' ? ' not null' : ''); - } - } - if ($alter && !fof_db_query("alter table $table ".implode(', ', $alter))) - { - exit("Can't change engine or encoding of $table. MySQL says: " . mysql_error() . "
"); - } + if ($alter) + fof_db_query("alter table $table ".implode(', ', $alter)); } -if (!mysql_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_image_cache_date'")) && - !fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_image_cache_date` INT( 11 ) DEFAULT '0' AFTER `feed_image`;")) - exit("Can't add column feed_image_cache_date to table $FOF_FEED_TABLE. MySQL says: " . mysql_error() . "
"); +if (!fof_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_image_cache_date'"))) + fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_image_cache_date` INT( 11 ) DEFAULT '0' AFTER `feed_image`;"); -if (!mysql_num_rows(fof_db_query("show columns from $FOF_USER_TABLE like 'user_password_hash'")) && - (!fof_db_query("ALTER TABLE $FOF_USER_TABLE CHANGE `user_password` `user_password_hash` VARCHAR( 32 ) NOT NULL") || - !fof_db_query("update $FOF_USER_TABLE set user_password_hash = md5(concat(user_password_hash, user_name))"))) - exit("Can't change column user_password to user_password_hash. MySQL says: " . mysql_error() . "
"); +if (!fof_num_rows(fof_db_query("show columns from $FOF_USER_TABLE like 'user_password_hash'"))) +{ + fof_db_query("ALTER TABLE $FOF_USER_TABLE CHANGE `user_password` `user_password_hash` VARCHAR( 32 ) NOT NULL"); + fof_db_query("update $FOF_USER_TABLE set user_password_hash = md5(concat(user_password_hash, user_name))"); +} -if (!mysql_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_cache_attempt_date'")) && - !fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_cache_attempt_date` INT( 11 ) DEFAULT '0' AFTER `feed_cache_date`;")) - exit("Can't add column feed_cache_attempt_date to table $FOF_FEED_TABLE. MySQL says: " . mysql_error() . "
"); +if (!fof_num_rows(fof_db_query("show columns from $FOF_FEED_TABLE like 'feed_cache_attempt_date'"))) + fof_db_query("ALTER TABLE $FOF_FEED_TABLE ADD `feed_cache_attempt_date` INT( 11 ) DEFAULT '0' AFTER `feed_cache_date`;"); -if (!mysql_num_rows(fof_db_query("show columns from $FOF_ITEM_TABLE like 'item_author'")) && - !fof_db_query("ALTER TABLE $FOF_ITEM_TABLE ADD `item_author` text NOT NULL AFTER `item_title`;")) - exit("Can't add column item_author to table $FOF_ITEM_TABLE. MySQL says: " . mysql_error() . "
"); +if (!fof_num_rows(fof_db_query("show columns from $FOF_ITEM_TABLE like 'item_author'"))) + fof_db_query("ALTER TABLE $FOF_ITEM_TABLE ADD `item_author` text NOT NULL AFTER `item_title`;"); -$check = mysql_fetch_row(fof_db_query("show create table $FOF_ITEM_TABLE")); -if (strpos($check[1], 'KEY `feed_id`') !== false && - !fof_db_query("alter table $FOF_ITEM_TABLE drop key feed_id, add key item_published (item_published)")) - exit("Can't drop key feed id / add key item_published to table $FOF_ITEM_TABLE. MySQL says: " . mysql_error() . "
"); +$check = fof_db_get_row(fof_db_query("show create table $FOF_ITEM_TABLE")); +if (strpos($check[1], 'KEY `feed_id`') !== false) + fof_db_query("alter table $FOF_ITEM_TABLE drop key feed_id, add key item_published (item_published)"); add_fk($check[1], $FOF_ITEM_TABLE, 'feed_id', $FOF_FEED_TABLE, 'on update cascade'); -$check = mysql_fetch_row(fof_db_query("show create table $FOF_ITEM_TAG_TABLE")); +$check = fof_db_get_row(fof_db_query("show create table $FOF_ITEM_TAG_TABLE")); add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'tag_id', $FOF_TAG_TABLE); add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'user_id', $FOF_USER_TABLE); add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'item_id', $FOF_ITEM_TABLE); -if (strpos($check[1], 'PRIMARY KEY (`user_id`,`item_id`,`tag_id`)') !== false && - !fof_db_query("alter table $FOF_ITEM_TAG_TABLE add key user_id (user_id),". +if (strpos($check[1], 'PRIMARY KEY (`user_id`,`item_id`,`tag_id`)') !== false) +{ + fof_db_query( + "alter table $FOF_ITEM_TAG_TABLE add key user_id (user_id),". " add key item_id_user_id_tag_id (item_id, user_id, tag_id), drop primary key,". - " add primary key (tag_id, user_id, item_id), drop key tag_id, drop key item_id")) - exit("Can't change indexes on table $FOF_ITEM_TAG_TABLE. MySQL says: " . mysql_error() . "
"); + " add primary key (tag_id, user_id, item_id), drop key tag_id, drop key item_id" + ); +} -if (!strpos($check[1], '`item_published`') && - !fof_db_query("alter table $FOF_ITEM_TAG_TABLE add item_published int not null default '0',". +if (!strpos($check[1], '`item_published`')) +{ + fof_db_query( + "alter table $FOF_ITEM_TAG_TABLE add item_published int not null default '0',". " add feed_id int not null default 0,". " add key tag_id_user_id_item_published_item_id (tag_id, user_id, item_published, item_id),". " add key tag_id_user_id_feed_id (tag_id, user_id, feed_id),". - " add key feed_id (feed_id)")) - exit("Can't add item_published and feed_id columns to table $FOF_ITEM_TAG_TABLE. MySQL says: " . mysql_error() . "
"); + " add key feed_id (feed_id)" + ); +} -if (mysql_num_rows(fof_db_query("select count(*) from $FOF_ITEM_TAG_TABLE where feed_id=0")) && - !fof_db_query("update $FOF_ITEM_TAG_TABLE it, $FOF_ITEM_TABLE i". +if (fof_num_rows(fof_db_query("select count(*) from $FOF_ITEM_TAG_TABLE where feed_id=0"))) +{ + fof_db_query( + "update $FOF_ITEM_TAG_TABLE it, $FOF_ITEM_TABLE i". " set it.item_published=i.item_published, it.feed_id=i.feed_id". - " where it.feed_id=0 and it.item_id=i.item_id")) - exit("Can't copy item_published and feed_id from $FOF_ITEM_TABLE to $FOF_ITEM_TAG_TABLE. MySQL says: " . mysql_error() . "
"); + " where it.feed_id=0 and it.item_id=i.item_id" + ); +} add_fk($check[1], $FOF_ITEM_TAG_TABLE, 'feed_id', $FOF_FEED_TABLE); @@ -379,7 +373,7 @@ Cache directory exists and is writable.
You now need to choose an initial password for the 'admin' account: