]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #2859 from rabuzarus/0510-update_fullcalendar
authorfabrixxm <fabrix.xm@gmail.com>
Mon, 17 Oct 2016 18:14:01 +0000 (20:14 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Oct 2016 18:14:01 +0000 (20:14 +0200)
quattro: fix events_reminder

16 files changed:
boot.php
database.sql
doc/upgrade.md [new file with mode: 0644]
include/Core/Config.php
include/Core/PConfig.php
include/Probe.php
include/dba.php
include/dbstructure.php
include/items.php
include/poller.php
include/salmon.php
mod/admin.php
mod/item.php
mod/nodeinfo.php
update.php
view/theme/frio/css/style.css

index 1c475ca935fef5f7cccaf32bdf718db0e48223a1..f39fb0369cba8696d9037577f301b6fc0cd12530 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Asparagus');
 define ( 'FRIENDICA_VERSION',      '3.5.1-dev' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1204      );
+define ( 'DB_UPDATE_VERSION',      1206      );
 
 /**
  * @brief Constant with a HTML line break.
@@ -53,7 +53,7 @@ define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
 
 /**
  * @brief Image storage quality.
- * 
+ *
  * Lower numbers save space at cost of image detail.
  * For ease of upgrade, please do not change here. Change jpeg quality with
  * $a->config['system']['jpeg_quality'] = n;
@@ -95,7 +95,7 @@ define ( 'DEFAULT_DB_ENGINE',  'MyISAM'  );
 
 /**
  * @name SSL Policy
- * 
+ *
  * SSL redirection policies
  * @{
  */
@@ -106,7 +106,7 @@ define ( 'SSL_POLICY_SELFSIGN',     2 );
 
 /**
  * @name Logger
- * 
+ *
  * log levels
  * @{
  */
@@ -119,7 +119,7 @@ define ( 'LOGGER_ALL',             4 );
 
 /**
  * @name Cache
- * 
+ *
  * Cache levels
  * @{
  */
@@ -131,7 +131,7 @@ define ( 'CACHE_HOUR',             3 );
 
 /**
  * @name Register
- * 
+ *
  * Registration policies
  * @{
  */
@@ -142,7 +142,7 @@ define ( 'REGISTER_OPEN',          2 );
 
 /**
  * @name Contact_is
- * 
+ *
  * Relationship types
  * @{
  */
@@ -153,7 +153,7 @@ define ( 'CONTACT_IS_FRIEND',   3);
 
 /**
  * @name Update
- * 
+ *
  * DB update return values
  * @{
  */
@@ -205,7 +205,7 @@ define ( 'ACCOUNT_TYPE_COMMUNITY',   3 );
 
 /**
  * @name CP
- * 
+ *
  * Type of the community page
  * @{
  */
@@ -216,7 +216,7 @@ define ( 'CP_GLOBAL_COMMUNITY',    1 );
 
 /**
  * @name Network
- * 
+ *
  * Network and protocol family types
  * @{
  */
@@ -288,7 +288,7 @@ define ( 'ZCURL_TIMEOUT' , (-1));
 
 /**
  * @name Notify
- * 
+ *
  * Email notification options
  * @{
  */
@@ -310,7 +310,7 @@ define ( 'NOTIFY_SYSTEM',   0x8000 );
 
 /**
  * @name Term
- * 
+ *
  * Tag/term types
  * @{
  */
@@ -330,7 +330,7 @@ define ( 'TERM_OBJ_PHOTO', 2 );
 
 /**
  * @name Namespaces
- * 
+ *
  * Various namespaces we may need to parse
  * @{
  */
@@ -353,7 +353,7 @@ define ( 'NAMESPACE_ATOM1',           'http://www.w3.org/2005/Atom' );
 
 /**
  * @name Activity
- * 
+ *
  * Activity stream defines
  * @{
  */
@@ -399,7 +399,7 @@ define ( 'ACTIVITY_OBJ_QUESTION', 'http://activityschema.org/object/question' );
 
 /**
  * @name Gravity
- * 
+ *
  * Item weight for query ordering
  * @{
  */
@@ -466,9 +466,9 @@ function startup() {
 /**
  *
  * class: App
- * 
+ *
  * @brief Our main application structure for the life of this page.
- * 
+ *
  * Primarily deals with the URL that got us here
  * and tries to make some sense of it, and
  * stores our page contents and config storage
@@ -1015,9 +1015,9 @@ class App {
 
        /**
         * @brief Register template engine class
-        * 
+        *
         * If $name is "", is used class static property $class::$name
-        * 
+        *
         * @param string $class
         * @param string $name
         */
@@ -1035,7 +1035,7 @@ class App {
 
        /**
         * @brief Return template engine instance.
-        * 
+        *
         * If $name is not defined, return engine defined by theme,
         * or default
         *
@@ -1358,7 +1358,7 @@ class App {
 
 /**
  * @brief Retrieve the App structure
- * 
+ *
  * Useful in functions which require it but don't get it passed to them
  */
 function get_app() {
@@ -1612,7 +1612,7 @@ function run_update_function($x) {
  * and mark it uninstalled in the database (for now we'll remove it).
  * Then go through the config list and if we have a plugin that isn't installed,
  * call the install procedure and add it to the database.
- * 
+ *
  * @param App $a
  *
         */
@@ -1678,17 +1678,17 @@ function get_guid($size=16, $prefix = "") {
        }
 }
 
-/** 
+/**
  * @brief Wrapper for adding a login box.
- * 
+ *
  * @param bool $register
  *     If $register == true provide a registration link.
  *     This will most always depend on the value of $a->config['register_policy'].
  * @param bool $hiddens
- * 
+ *
  * @return string
  *     Returns the complete html for inserting into the page
- * 
+ *
  * @hooks 'login_hook'
  *     string $o
  */
@@ -1778,7 +1778,7 @@ function goaway($s) {
 
 /**
  * @brief Returns the user id of locally logged in user or false.
- * 
+ *
  * @return int|bool user id or false
  */
 function local_user() {
@@ -1789,7 +1789,7 @@ function local_user() {
 
 /**
  * @brief Returns contact id of authenticated site visitor or false
- * 
+ *
  * @return int|bool visitor_id or false
  */
 function remote_user() {
@@ -1846,13 +1846,13 @@ function get_max_import_size() {
  *     so plugins can take part in process :)
  *
  * @param (string|integer) $cmd program to run or priority
- * 
+ *
  * next args are passed as $cmd command line
  * e.g.: proc_run("ls","-la","/tmp");
  * or: proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
  *
  * @note $cmd and string args are surrounded with ""
- * 
+ *
  * @hooks 'proc_run'
  *     array $arr
  */
@@ -2011,9 +2011,9 @@ function current_theme(){
 
 /**
  * @brief Return full URL to theme which is currently in effect.
- * 
+ *
  * Provide a sane default if nothing is chosen or the specified theme does not exist.
- * 
+ *
  * @return string
  */
 function current_theme_url() {
@@ -2360,7 +2360,7 @@ function current_load() {
 
 /**
  * @brief get c-style args
- * 
+ *
  * @return int
  */
 function argc() {
@@ -2369,7 +2369,7 @@ function argc() {
 
 /**
  * @brief Returns the value of a argv key
- * 
+ *
  * @param int $x argv key
  * @return string Value of the argv key
  */
@@ -2382,12 +2382,12 @@ function argv($x) {
 
 /**
  * @brief Get the data which is needed for infinite scroll
- * 
+ *
  * For invinite scroll we need the page number of the actual page
  * and the the URI where the content of the next page comes from.
  * This data is needed for the js part in main.js.
  * Note: infinite scroll does only work for the network page (module)
- * 
+ *
  * @param string $module The name of the module (e.g. "network")
  * @return array Of infinite scroll data
  *     'pageno' => $pageno The number of the actual page
index 4133d3e825dc66f60150b98fc0c9ad344a4433d9..f12746e7e53b5b598b99df84207f06dcf00dafee 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 3.5.1-dev (Asparagus)
--- DB_UPDATE_VERSION 1204
+-- DB_UPDATE_VERSION 1205
 -- ------------------------------------------
 
 
@@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `config` (
        `k` varchar(255) NOT NULL DEFAULT '',
        `v` text,
         PRIMARY KEY(`id`),
-        INDEX `cat_k` (`cat`(30),`k`(30))
+        UNIQUE INDEX `cat_k` (`cat`(30),`k`(30))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -707,7 +707,7 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
        `k` varchar(255) NOT NULL DEFAULT '',
        `v` mediumtext,
         PRIMARY KEY(`id`),
-        INDEX `uid_cat_k` (`uid`,`cat`(30),`k`(30))
+        UNIQUE INDEX `uid_cat_k` (`uid`,`cat`(30),`k`(30))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
diff --git a/doc/upgrade.md b/doc/upgrade.md
new file mode 100644 (file)
index 0000000..778f935
--- /dev/null
@@ -0,0 +1,34 @@
+# Considerations before upgrading Friendica
+
+* [Home](help)
+
+## MySQL >= 5.7.4
+
+Starting from MySQL version 5.7.4, the IGNORE keyword in ALTER TABLE statements is ignored.
+This prevents automatic table deduplication if a UNIQUE index is added to a Friendica table's structure.
+If a DB update fails for you while creating a UNIQUE index, make sure to manually deduplicate the table before trying the update again.
+
+### Manual deduplication
+
+There are two main ways of doing it, either by manually removing the duplicates or by recreating the table.
+Manually removing the duplicates is usually faster if they're not too numerous.
+To manually remove the duplicates, you need to know the UNIQUE index columns available in `database.sql`.
+
+```SQL
+SELECT GROUP_CONCAT(id), <index columns>, count(*) as count FROM users
+GROUP BY <index columns> HAVING count >= 2;
+
+/* delete or merge duplicate from above query */;
+```
+
+If there are too many rows to handle manually, you can create a new table with the same structure as the table with duplicates and insert the existing content with INSERT IGNORE.
+To recreate the table you need to know the table structure available in `database.sql`.
+
+```SQL
+CREATE TABLE <table_name>_new <rest of the CREATE TABLE>;
+INSERT IGNORE INTO <table_name>_new SELECT * FROM <table_name>;
+DROP TABLE <table_name>;
+RENAME TABLE <table_name>_new TO <table_name>;
+```
+
+This method is slower overall, but it is better suited for large numbers of duplicates.
\ No newline at end of file
index 5703558cf336f93103b53659d3e5598286d7daf7..a93f188148e9c76740edd8205a8823fa895766eb 100644 (file)
@@ -32,7 +32,7 @@ class Config {
        public static function load($family) {
                global $a;
 
-               $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family));
+               $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
                if(count($r)) {
                        foreach($r as $rr) {
                                $k = $rr['k'];
@@ -90,7 +90,7 @@ class Config {
                        }
                }
 
-               $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
+               $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
                        dbesc($family),
                        dbesc($key)
                );
@@ -126,37 +126,19 @@ class Config {
        public static function set($family,$key,$value) {
                global $a;
 
-               // If $a->config[$family] has been previously set to '!<unset>!', then
-               // $a->config[$family][$key] will evaluate to $a->config[$family][0], and
-               // $a->config[$family][$key] = $value will be equivalent to
-               // $a->config[$family][0] = $value[0] (this causes infuriating bugs),
-               // so unset the family before assigning a value to a family's key
-               if($a->config[$family] === '!<unset>!')
-                       unset($a->config[$family]);
+               $a->config[$family][$key] = $value;
 
                // manage array value
                $dbvalue = (is_array($value)?serialize($value):$value);
                $dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue);
-               if(is_null(self::get($family,$key,null,true))) {
-                       $a->config[$family][$key] = $value;
-                       $ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
-                               dbesc($family),
-                               dbesc($key),
-                               dbesc($dbvalue)
-                       );
-                       if($ret)
-                               return $value;
-                       return $ret;
-               }
 
-               $ret = q("UPDATE `config` SET `v` = '%s' WHERE `cat` = '%s' AND `k` = '%s'",
-                       dbesc($dbvalue),
+               $ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' )
+ON DUPLICATE KEY UPDATE `v` = '%s'",
                        dbesc($family),
-                       dbesc($key)
+                       dbesc($key),
+                       dbesc($dbvalue),
+                       dbesc($dbvalue)
                );
-
-               $a->config[$family][$key] = $value;
-
                if($ret)
                        return $value;
                return $ret;
index 2bc08667a7f2f431e72686f32333971dd8e8a1bf..de8994d1decf2219aa378602b25247fd724eaf51 100644 (file)
@@ -29,7 +29,7 @@ class PConfig {
         */
        public static function load($uid,$family) {
                global $a;
-               $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d",
+               $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d ORDER BY `cat`, `k`, `id`",
                        dbesc($family),
                        intval($uid)
                );
@@ -83,7 +83,7 @@ class PConfig {
                        }
                }
 
-               $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
+               $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
                        intval($uid),
                        dbesc($family),
                        dbesc($key)
@@ -126,27 +126,16 @@ class PConfig {
                // manage array value
                $dbvalue = (is_array($value)?serialize($value):$value);
 
-               if(is_null(self::get($uid,$family,$key,null, true))) {
-                       $a->config[$uid][$family][$key] = $value;
-                       $ret = q("INSERT INTO `pconfig` ( `uid`, `cat`, `k`, `v` ) VALUES ( %d, '%s', '%s', '%s' ) ",
-                               intval($uid),
-                               dbesc($family),
-                               dbesc($key),
-                               dbesc($dbvalue)
-                       );
-                       if($ret)
-                               return $value;
-                       return $ret;
-               }
-               $ret = q("UPDATE `pconfig` SET `v` = '%s' WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s'",
-                       dbesc($dbvalue),
+               $a->config[$uid][$family][$key] = $value;
+
+               $ret = q("INSERT INTO `pconfig` ( `uid`, `cat`, `k`, `v` ) VALUES ( %d, '%s', '%s', '%s' )
+ON DUPLICATE KEY UPDATE `v` = '%s'",
                        intval($uid),
                        dbesc($family),
-                       dbesc($key)
+                       dbesc($key),
+                       dbesc($dbvalue),
+                       dbesc($dbvalue)
                );
-
-               $a->config[$uid][$family][$key] = $value;
-
                if($ret)
                        return $value;
                return $ret;
index 44824103b452042dfd93c1bdc7fc414a4d39ec44..a245ef250f2e12b001de453a98d6dca410795761 100644 (file)
@@ -118,18 +118,16 @@ class Probe {
         */
 
        public static function webfinger_dfrn($webbie, &$hcard) {
-               if (!strstr($webbie, '@'))
-                       return $webbie;
 
                $profile_link = '';
 
-               $links = self::webfinger($webbie);
+               $links = self::lrdd($webbie);
                logger('webfinger_dfrn: '.$webbie.':'.print_r($links,true), LOGGER_DATA);
                if (count($links)) {
                        foreach ($links as $link) {
                                if ($link['@attributes']['rel'] === NAMESPACE_DFRN)
                                        $profile_link = $link['@attributes']['href'];
-                               if ($link['@attributes']['rel'] === NAMESPACE_OSTATUSSUB)
+                               if (($link['@attributes']['rel'] === NAMESPACE_OSTATUSSUB) AND ($profile_link == ""))
                                        $profile_link = 'stat:'.$link['@attributes']['template'];
                                if ($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard')
                                        $hcard = $link['@attributes']['href'];
@@ -180,6 +178,11 @@ class Probe {
 
                        $path = str_replace('{uri}', urlencode($uri), $link);
                        $webfinger = self::webfinger($path);
+
+                       if (!$webfinger AND (strstr($uri, "@"))) {
+                               $path = str_replace('{uri}', urlencode("acct:".$uri), $link);
+                               $webfinger = self::webfinger($path);
+                       }
                }
 
                if (!is_array($webfinger["links"]))
@@ -310,6 +313,7 @@ class Probe {
                                return array("network" => NETWORK_TWITTER);
 
                        $lrdd = self::xrd($host);
+
                        if (!$lrdd)
                                return self::mail($uri, $uid);
 
@@ -356,6 +360,12 @@ class Probe {
                        $path = str_replace('{uri}', urlencode($addr), $link);
                        $webfinger = self::webfinger($path);
 
+                       // Mastodon needs to have it with "acct:"
+                       if (!$webfinger) {
+                               $path = str_replace('{uri}', urlencode("acct:".$addr), $link);
+                               $webfinger = self::webfinger($path);
+                       }
+
                        // If webfinger wasn't successful then try it with the URL - possibly in the format https://...
                        if (!$webfinger AND ($uri != $addr)) {
                                $path = str_replace('{uri}', urlencode($uri), $link);
@@ -815,6 +825,9 @@ class Probe {
                                if (strstr($alias, "@"))
                                        $data["addr"] = str_replace('acct:', '', $alias);
 
+               if (is_string($webfinger["subject"]) AND strstr($webfinger["subject"], "@"))
+                       $data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
+
                $pubkey = "";
                foreach ($webfinger["links"] AS $link) {
                        if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
@@ -832,7 +845,7 @@ class Probe {
                                                $pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
                                        else
                                                $pubkey = substr($pubkey, 5);
-                               } else
+                               } elseif (normalise_link($pubkey) == 'http://')
                                        $pubkey = fetch_url($pubkey);
 
                                $key = explode(".", $pubkey);
index 97f6c8795645492aeda5f47cd5707dc0b325545a..86a3762b44f041945891eca407e5e31269fd7b77 100644 (file)
@@ -91,6 +91,23 @@ class dba {
                return $this->db;
        }
 
+       /**
+        * @brief Returns the MySQL server version string
+        * 
+        * This function discriminate between the deprecated mysql API and the current
+        * object-oriented mysqli API. Example of returned string: 5.5.46-0+deb8u1
+        *
+        * @return string
+        */
+       public function server_info() {
+               if ($this->mysqli) {
+                       $return = $this->db->server_info;
+               } else {
+                       $return = mysql_get_server_info($this->db);
+               }
+               return $return;
+       }
+
        public function q($sql, $onlyquery = false) {
                global $a;
 
index 32d5986fe97f27398f51b0af1e0a0bd446c2e2ca..fdf09d90def8abd034d0801540fa02ca2ed744b4 100644 (file)
@@ -78,6 +78,10 @@ function table_structure($table) {
                        if ($index["Index_type"] == "FULLTEXT")
                                continue;
 
+                       if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
+                               $indexdata[$index["Key_name"]] = array('UNIQUE');
+                       }
+
                        $column = $index["Column_name"];
                        // On utf8mb4 a varchar index can only have a length of 191
                        // To avoid the need to add this to every index definition we just ignore it here.
@@ -154,6 +158,20 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
        if (is_null($definition))
                $definition = db_definition($charset);
 
+       // Ensure index conversion to unique removes duplicates
+       $sql_config = "SET session old_alter_table=1;";
+       if ($verbose)
+               echo $sql_config."\n";
+       if ($action)
+               @$db->q($sql_config);
+
+       // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
+       if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
+               !(strpos($db->server_info(), 'MariaDB') !== false)) {
+               $ignore = '';
+       }else {
+               $ignore = ' IGNORE';
+       }
 
        // Compare it
        foreach ($definition AS $name => $structure) {
@@ -179,7 +197,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
                                if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
                                        $sql2=db_drop_index($indexname);
                                        if ($sql3 == "")
-                                               $sql3 = "ALTER TABLE `".$name."` ".$sql2;
+                                               $sql3 = "ALTER".$ignore." TABLE `".$name."` ".$sql2;
                                        else
                                                $sql3 .= ", ".$sql2;
                                }
@@ -223,7 +241,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
                                        $sql2=db_create_index($indexname, $fieldnames);
                                        if ($sql2 != "") {
                                                if ($sql3 == "")
-                                                       $sql3 = "ALTER TABLE `".$name."` ".$sql2;
+                                                       $sql3 = "ALTER" . $ignore . " TABLE `".$name."` ".$sql2;
                                                else
                                                        $sql3 .= ", ".$sql2;
                                        }
@@ -330,6 +348,11 @@ function db_create_index($indexname, $fieldnames, $method="ADD") {
                killme();
        }
 
+       if ($fieldnames[0] == "UNIQUE") {
+               array_shift($fieldnames);
+               $method .= ' UNIQUE';
+       }
+
        $names = "";
        foreach ($fieldnames AS $fieldname) {
                if ($names != "")
@@ -457,7 +480,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "cat_k" => array("cat(30)","k(30)"),
+                                       "cat_k" => array("UNIQUE", "cat(30)","k(30)"),
                                        )
                        );
        $database["contact"] = array(
@@ -1067,7 +1090,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "uid_cat_k" => array("uid","cat(30)","k(30)"),
+                                       "uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
                                        )
                        );
        $database["photo"] = array(
@@ -1491,6 +1514,9 @@ function dbstructure_run(&$argv, &$argc) {
 
        if ($argc==2) {
                switch ($argv[1]) {
+                       case "dryrun":
+                               update_structure(true, false);
+                               return;
                        case "update":
                                update_structure(true, true);
 
@@ -1523,7 +1549,8 @@ function dbstructure_run(&$argv, &$argc) {
        // print help
        echo $argv[0]." <command>\n";
        echo "\n";
-       echo "commands:\n";
+       echo "Commands:\n";
+       echo "dryrun            show database update schema queries without running them\n";
        echo "update            update database schema\n";
        echo "dumpsql           dump database schema\n";
        return;
index 6d2c830f96ba8cf4a2c9ea63e59e1313371a7915..5f0187ad97df61be53ec7a73e07e38f3f3a111c7 100644 (file)
@@ -669,7 +669,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
 
                        // If its a post from myself then tag the thread as "mention"
                        logger("item_store: Checking if parent ".$parent_id." has to be tagged as mention for user ".$arr['uid'], LOGGER_DEBUG);
-                       $u = q("select * from user where uid = %d limit 1", intval($arr['uid']));
+                       $u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid']));
                        if(count($u)) {
                                $a = get_app();
                                $self = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']);
@@ -679,8 +679,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                                        logger("item_store: tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG);
                                }
                        }
-               }
-               else {
+               } else {
 
                        // Allow one to see reply tweets from status.net even when
                        // we don't have or can't see the original post.
@@ -735,6 +734,19 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                $arr["global"] = (count($isglobal) > 0);
        }
 
+       // ACL settings
+       if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid))
+               $private = 1;
+       else
+               $private = $arr['private'];
+
+       $arr["allow_cid"] = $allow_cid;
+       $arr["allow_gid"] = $allow_gid;
+       $arr["deny_cid"] = $deny_cid;
+       $arr["deny_gid"] = $deny_gid;
+       $arr["private"] = $private;
+       $arr["deleted"] = $parent_deleted;
+
        // Fill the cache field
        put_item_in_cache($arr);
 
@@ -807,41 +819,38 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                                dbesc($arr['received']),
                                intval($arr['contact-id'])
                        );
+
+               // Now do the same for the system wide contacts with uid=0
+               if (!$arr['private']) {
+                       q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
+                               dbesc($arr['received']),
+                               dbesc($arr['received']),
+                               intval($arr['owner-id'])
+                       );
+
+                       if ($arr['owner-id'] != $arr['author-id'])
+                               q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
+                                       dbesc($arr['received']),
+                                       dbesc($arr['received']),
+                                       intval($arr['author-id'])
+                               );
+               }
        } else {
                logger('item_store: could not locate created item');
                return 0;
        }
 
-       if((! $parent_id) || ($arr['parent-uri'] === $arr['uri']))
+       if(!$parent_id || ($arr['parent-uri'] === $arr['uri']))
                $parent_id = $current_post;
 
-       if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid))
-               $private = 1;
-       else
-               $private = $arr['private'];
-
-       // Set parent id - and also make sure to inherit the parent's ACLs.
-
-       $r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s',
-               `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d, `deleted` = %d WHERE `id` = %d",
+       // Set parent id
+       $r = q("UPDATE `item` SET `parent` = %d WHERE `id` = %d",
                intval($parent_id),
-               dbesc($allow_cid),
-               dbesc($allow_gid),
-               dbesc($deny_cid),
-               dbesc($deny_gid),
-               intval($private),
-               intval($parent_deleted),
                intval($current_post)
        );
 
        $arr['id'] = $current_post;
        $arr['parent'] = $parent_id;
-       $arr['allow_cid'] = $allow_cid;
-       $arr['allow_gid'] = $allow_gid;
-       $arr['deny_cid'] = $deny_cid;
-       $arr['deny_gid'] = $deny_gid;
-       $arr['private'] = $private;
-       $arr['deleted'] = $parent_deleted;
 
        // update the commented timestamp on the parent
        // Only update "commented" if it is really a comment
index fe4d4245af8df0a3a3d6fc4c6f94accbe2c5e7b5..c1761e302db6814dbb7c26d34068d0ef02dc03e6 100644 (file)
@@ -73,7 +73,7 @@ function poller_run(&$argv, &$argc){
 
        $starttime = time();
 
-       while ($r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority`, `created` LIMIT 1")) {
+       while ($r = poller_worker_process()) {
 
                // Quit when in maintenance
                if (get_config('system', 'maintenance', true))
@@ -128,8 +128,16 @@ function poller_run(&$argv, &$argc){
 
                if (function_exists($funcname)) {
                        logger("Process ".$mypid." - Prio ".$r[0]["priority"]." - ID ".$r[0]["id"].": ".$funcname." ".$r[0]["parameter"]);
+
+                       // For better logging create a new process id for every worker call
+                       // But preserve the old one for the worker
+                       $old_process_id = $a->process_id;
+                       $a->process_id = uniqid("wrk", true);
+
                        $funcname($argv, $argc);
 
+                       $a->process_id = $old_process_id;
+
                        if ($cooldown > 0) {
                                logger("Process ".$mypid." - Prio ".$r[0]["priority"]." - ID ".$r[0]["id"].": ".$funcname." - in cooldown for ".$cooldown." seconds");
                                sleep($cooldown);
@@ -320,7 +328,28 @@ function poller_too_much_workers() {
                        }
                }
 
-               logger("Current load: ".$load." - maximum: ".$maxsysload." - current queues: ".$active."/".$entries." - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
+               // Create a list of queue entries grouped by their priority
+               $running = array(PRIORITY_CRITICAL => 0,
+                               PRIORITY_HIGH => 0,
+                               PRIORITY_MEDIUM => 0,
+                               PRIORITY_LOW => 0,
+                               PRIORITY_NEGLIGIBLE => 0);
+
+               $r = q("SELECT COUNT(*) AS `running`, `priority` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` GROUP BY `priority`");
+               if (dbm::is_result($r))
+                       foreach ($r AS $process)
+                               $running[$process["priority"]] = $process["running"];
+
+               $processlist = "";
+               $r = q("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` GROUP BY `priority`");
+               if (dbm::is_result($r))
+                       foreach ($r as $entry) {
+                               if ($processlist != "")
+                                       $processlist .= ", ";
+                               $processlist .= $entry["priority"].":".$running[$entry["priority"]]."/".$entry["entries"];
+                       }
+
+               logger("Load: ".$load."/".$maxsysload." - processes: ".$active."/".$entries." (".$processlist.") - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
 
                // Are there fewer workers running as possible? Then fork a new one.
                if (!get_config("system", "worker_dont_fork") AND ($queues > ($active + 1)) AND ($entries > 1)) {
@@ -340,6 +369,89 @@ function poller_active_workers() {
        return($workers[0]["processes"]);
 }
 
+/**
+ * @brief Check if we should pass some slow processes
+ *
+ * When the active processes of the highest priority are using more than 2/3
+ * of all processes, we let pass slower processes.
+ *
+ * @param string $highest_priority Returns the currently highest priority
+ * @return bool We let pass a slower process than $highest_priority
+ */
+function poller_passing_slow(&$highest_priority) {
+
+       $highest_priority = 0;
+
+       $r = q("SELECT `priority`
+               FROM `process`
+               INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
+               WHERE `process`.`command` = 'poller.php'");
+
+       // No active processes at all? Fine
+       if (!dbm::is_result($r))
+               return(false);
+
+       $priorities = array();
+       foreach ($r AS $line)
+               $priorities[] = $line["priority"];
+
+       // Should not happen
+       if (count($priorities) == 0)
+               return(false);
+
+       $highest_priority = min($priorities);
+
+       // The highest process is already the slowest one?
+       // Then we quit
+       if ($highest_priority == PRIORITY_NEGLIGIBLE)
+               return(false);
+
+       $high = 0;
+       foreach ($priorities AS $priority)
+               if ($priority == $highest_priority)
+                       ++$high;
+
+       logger("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, LOGGER_DEBUG);
+       $passing_slow = (($high/count($priorities)) > (2/3));
+
+       if ($passing_slow)
+               logger("Passing slower processes than priority ".$highest_priority, LOGGER_DEBUG);
+
+       return($passing_slow);
+}
+
+/**
+ * @brief Returns the next worker process
+ *
+ * @return string SQL statement
+ */
+
+function poller_worker_process() {
+
+       // Check if we should pass some low priority process
+       $highest_priority = 0;
+
+       if (poller_passing_slow($highest_priority)) {
+               // Are there waiting processes with a higher priority than the currently highest?
+               $r = q("SELECT * FROM `workerqueue`
+                               WHERE `executed` = '0000-00-00 00:00:00' AND `priority` < %d
+                               ORDER BY `priority`, `created` LIMIT 1", dbesc($highest_priority));
+               if (dbm::is_result($r))
+                       return $r;
+
+               // Give slower processes some processing time
+               $r = q("SELECT * FROM `workerqueue`
+                               WHERE `executed` = '0000-00-00 00:00:00' AND `priority` > %d
+                               ORDER BY `priority`, `created` LIMIT 1", dbesc($highest_priority));
+       }
+
+       // If there is no result (or we shouldn't pass lower processes) we check without priority limit
+       if (($highest_priority == 0) OR !dbm::is_result($r))
+               $r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority`, `created` LIMIT 1");
+
+       return $r;
+}
+
 if (array_search(__file__,get_included_files())===0){
        poller_run($_SERVER["argv"],$_SERVER["argc"]);
 
index 8341b902a7a874b3db3e140d32478bda9b564962..5e9c4fa616dc1df20eec3c8d16ac372add35155e 100644 (file)
@@ -31,8 +31,7 @@ function get_salmon_key($uri,$keyhash) {
                                        $ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
                                else
                                        $ret[$x] = substr($ret[$x],5);
-                       }
-                       else
+                       } elseif (normalise_link($ret[$x]) == 'http://')
                                $ret[$x] = fetch_url($ret[$x]);
                }
        }
index 8fb0df24c411b79d0fea28e1f7e4d616feca66eb..c9ff23e2d84c9e1899c0031d25e8585e2f60e3d3 100644 (file)
@@ -1279,14 +1279,14 @@ function admin_page_users(&$a){
 
        /* ordering */
        $valid_orders = array(
-               'contact.name', 
+               'contact.name',
                'user.email',
                'user.register_date',
                'user.login_date',
-               'lastitem.lastitem_date',
+               'lastitem_date',
                'user.page-flags'
        );
-       
+
        $order = "contact.name";
        $order_direction = "+";
        if (x($_GET,'o')){
@@ -1295,38 +1295,29 @@ function admin_page_users(&$a){
                        $order_direction = "-";
                        $new_order = substr($new_order,1);
                }
-               
+
                if (in_array($new_order, $valid_orders)){
                        $order = $new_order;
                }
                if (x($_GET,'d')){
                        $new_direction = $_GET['d'];
-                       
                }
        }
        $sql_order = "`".str_replace('.','`.`',$order)."`";
        $sql_order_direction = ($order_direction==="+")?"ASC":"DESC";
-       
-       $users = q("SELECT `user`.* , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`
-                               FROM
-                                       (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
-                                       FROM `item`
-                                       WHERE `item`.`type` = 'wall'
-                                       GROUP BY `item`.`uid`) AS `lastitem`
-                                                RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`,
-                                          `contact`
-                               WHERE
-                                          `user`.`uid` = `contact`.`uid`
-                                               AND `user`.`verified` =1
-                                       AND `contact`.`self` =1
-                               ORDER BY $sql_order $sql_order_direction LIMIT %d, %d
-                               ",
+
+       $users = q("SELECT `user`.*, `contact`.`name`, `contact`.`url`, `contact`.`micro`, `user`.`account_expired`,
+                               (SELECT MAX(`changed`) FROM `item` FORCE INDEX (`uid_wall_changed`) WHERE `wall` AND `uid` = `user`.`uid`) AS `lastitem_date`
+                               FROM `user`
+                               INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
+                               WHERE `user`.`verified`
+                               ORDER BY $sql_order $sql_order_direction LIMIT %d, %d",
                                intval($a->pager['start']),
                                intval($a->pager['itemspage'])
                                );
-    
+
        //echo "<pre>$users"; killme();
-                               
+
        $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
        $_setup_users = function ($e) use ($adminlist){
                $accounts = array(
index 9a9b5895bdd719e0c8b04d8abec606c7bc5eafac..e9056d08ccd9b6b3b24a812f1f38b907e4c31c02 100644 (file)
@@ -292,7 +292,6 @@ function item_post(&$a) {
                // If this is a comment, set the permissions from the parent.
 
                if($parent_item) {
-                       $private = 0;
 
                        // for non native networks use the network of the original post as network of the item
                        if (($parent_item['network'] != NETWORK_DIASPORA)
@@ -300,19 +299,13 @@ function item_post(&$a) {
                                AND ($network == ""))
                                $network = $parent_item['network'];
 
-                       if(($parent_item['private'])
-                               || strlen($parent_item['allow_cid'])
-                               || strlen($parent_item['allow_gid'])
-                               || strlen($parent_item['deny_cid'])
-                               || strlen($parent_item['deny_gid'])) {
-                               $private = (($parent_item['private']) ? $parent_item['private'] : 1);
-                       }
-
                        $str_contact_allow = $parent_item['allow_cid'];
                        $str_group_allow   = $parent_item['allow_gid'];
                        $str_contact_deny  = $parent_item['deny_cid'];
                        $str_group_deny    = $parent_item['deny_gid'];
+                       $private           = $parent_item['private'];
                }
+
                $pubmail_enable    = ((x($_REQUEST,'pubmail_enable') && intval($_REQUEST['pubmail_enable']) && (! $private)) ? 1 : 0);
 
                // if using the API, we won't see pubmail_enable - figure out if it should be set
@@ -460,7 +453,6 @@ function item_post(&$a) {
                                if(! count($r))
                                        continue;
 
-
                                $r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
                                        WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ",
                                        dbesc($str_contact_allow),
@@ -471,7 +463,6 @@ function item_post(&$a) {
                                        intval($profile_uid),
                                        dbesc( t('Wall Photos'))
                                );
-
                        }
                }
        }
@@ -725,6 +716,11 @@ function item_post(&$a) {
        $datarray['self']          = $self;
 //     $datarray['prvnets']       = $user['prvnets'];
 
+       $datarray['parent-uri'] = ($parent == 0) ? $uri : $parent_item['uri'];
+       $datarray['plink'] = $a->get_baseurl().'/display/'.urlencode($datarray['guid']);
+       $datarray['last-child'] = 1;
+       $datarray['visible'] = 1;
+
        if($orig_post)
                $datarray['edit']      = true;
 
@@ -789,11 +785,9 @@ function item_post(&$a) {
                        goaway($a->get_baseurl() . "/" . $return_path );
                }
                killme();
-       }
-       else
+       } else
                $post_id = 0;
 
-
        $r = q("INSERT INTO `item` (`guid`, `extid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`,
                                        `owner-name`,`owner-link`,`owner-avatar`, `owner-id`,
                                        `author-name`, `author-link`, `author-avatar`, `author-id`,
@@ -802,7 +796,8 @@ function item_post(&$a) {
                                        `tag`, `inform`, `verb`, `object-type`, `postopts`,
                                        `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`,
                                        `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file`,
-                                       `rendered-html`, `rendered-hash`)
+                                       `rendered-html`, `rendered-hash`,
+                                       `parent`, `parent-uri`, `plink`, `last-child`, `visible`)
                VALUES('%s', '%s', %d, '%s', %d, %d, '%s', %d,
                        '%s', '%s', '%s', %d,
                        '%s', '%s', '%s', %d,
@@ -811,7 +806,8 @@ function item_post(&$a) {
                        '%s', '%s', '%s', '%s', '%s',
                        '%s', '%s', '%s', '%s', %d,
                        %d, '%s', %d, %d, %d, '%s',
-                       '%s', '%s')",
+                       '%s', '%s',
+                       %d, '%s', '%s', %d, %d)",
                dbesc($datarray['guid']),
                dbesc($datarray['extid']),
                intval($datarray['uid']),
@@ -857,7 +853,12 @@ function item_post(&$a) {
                intval($datarray['moderated']),
                dbesc($datarray['file']),
                dbesc($datarray['rendered-html']),
-               dbesc($datarray['rendered-hash'])
+               dbesc($datarray['rendered-hash']),
+               intval($datarray['parent']),
+               dbesc($datarray['parent-uri']),
+               dbesc($datarray['plink']),
+               intval($datarray['last-child']),
+               intval($datarray['visible'])
               );
 
        $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@@ -873,7 +874,6 @@ function item_post(&$a) {
        logger('mod_item: saved item ' . $post_id);
 
        $datarray["id"] = $post_id;
-       $datarray["plink"] = $a->get_baseurl().'/display/'.urlencode($datarray["guid"]);
 
        // update filetags in pconfig
        file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
@@ -881,22 +881,17 @@ function item_post(&$a) {
        if($parent) {
 
                // This item is the last leaf and gets the comment box, clear any ancestors
-               $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d ",
+               $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d AND `last-child` AND `id` != %d",
                        dbesc(datetime_convert()),
-                       intval($parent)
+                       intval($parent),
+                       intval($post_id)
                );
-               update_thread($parent, true);
-
-               // Inherit ACLs from the parent item.
 
-               $r = q("UPDATE `item` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d
-                       WHERE `id` = %d",
-                       dbesc($parent_item['allow_cid']),
-                       dbesc($parent_item['allow_gid']),
-                       dbesc($parent_item['deny_cid']),
-                       dbesc($parent_item['deny_gid']),
-                       intval($parent_item['private']),
-                       intval($post_id)
+               // update the commented timestamp on the parent
+               q("UPDATE `item` SET `visible` = 1, `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
+                       dbesc(datetime_convert()),
+                       dbesc(datetime_convert()),
+                       intval($parent)
                );
 
                if($contact_record != $author) {
@@ -927,6 +922,10 @@ function item_post(&$a) {
        } else {
                $parent = $post_id;
 
+               $r = q("UPDATE `item` SET `parent` = %d WHERE `id` = %d",
+                       intval($parent),
+                       intval($post_id));
+
                if($contact_record != $author) {
                        notification(array(
                                'type'         => NOTIFY_WALL,
@@ -946,41 +945,6 @@ function item_post(&$a) {
                }
        }
 
-       // fallback so that parent always gets set to non-zero.
-
-       if(! $parent)
-               $parent = $post_id;
-
-       $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
-               WHERE `id` = %d",
-               intval($parent),
-               dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
-               dbesc($a->get_baseurl().'/display/'.urlencode($datarray['guid'])),
-               dbesc(datetime_convert()),
-               intval($post_id)
-       );
-
-       // photo comments turn the corresponding item visible to the profile wall
-       // This way we don't see every picture in your new photo album posted to your wall at once.
-       // They will show up as people comment on them.
-
-       if(! $parent_item['visible']) {
-               $r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d",
-                       intval($parent_item['id'])
-               );
-               update_thread($parent_item['id']);
-       }
-
-       // update the commented timestamp on the parent
-
-       q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
-               dbesc(datetime_convert()),
-               dbesc(datetime_convert()),
-               intval($parent)
-       );
-       if ($post_id != $parent)
-               update_thread($parent);
-
        call_hooks('post_local_end', $datarray);
 
        if(strlen($emailcc) && $profile_uid == local_user()) {
@@ -1022,6 +986,23 @@ function item_post(&$a) {
 
        if ($post_id == $parent)
                add_thread($post_id);
+       else {
+               update_thread($parent, true);
+
+               // Insert an item entry for UID=0 for global entries
+               // We have to remove or change some data before that,
+               // so that the post appear like a regular received post.
+               unset($datarray['self']);
+               unset($datarray['wall']);
+               unset($datarray['origin']);
+
+               if (in_array($datarray['type'], array("net-comment", "wall-comment")))
+                       $datarray['type'] = 'remote-comment';
+               elseif ($datarray['type'] == 'wall')
+                       $datarray['type'] = 'remote';
+
+               add_shadow_entry($datarray);
+       }
 
        // This is a real juggling act on shared hosting services which kill your processes
        // e.g. dreamhost. We used to start delivery to our native delivery agents in the background
index ba310a10514151c6cac11a507709164a6b4046c6..585659e5cb4ebd3cb86c7e2988ea2a47af18e95f 100644 (file)
@@ -185,20 +185,13 @@ function nodeinfo_cron() {
        }
         logger("cron_start");
 
-       $users = q("SELECT profile.*, `user`.`login_date`, `lastitem`.`lastitem_date`
-                       FROM (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
-                               FROM `item`
-                                       WHERE `item`.`type` = 'wall'
-                                               GROUP BY `item`.`uid`) AS `lastitem`
-                                               RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`, `contact`, `profile`
-                                WHERE
-                                       `user`.`uid` = `contact`.`uid` AND `profile`.`uid` = `user`.`uid`
-                                       AND `profile`.`is-default` AND (`profile`.`publish` OR `profile`.`net-publish`)
-                                       AND `user`.`verified` AND `contact`.`self`
-                                       AND NOT `user`.`blocked`
-                                       AND NOT `user`.`account_removed`
-                                       AND NOT `user`.`account_expired`");
-
+       $users = q("SELECT `user`.`uid`, `user`.`login_date`,
+                       (SELECT MAX(`changed`) FROM `item` FORCE INDEX (`uid_wall_changed`) WHERE `wall` AND `uid` = `user`.`uid`) AS `lastitem_date`
+                       FROM `user`
+                       INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` AND `profile`.`is-default`
+                       WHERE (`profile`.`publish` OR `profile`.`net-publish`) AND `user`.`verified`
+                               AND NOT `user`.`blocked` AND NOT `user`.`account_removed`
+                               AND NOT `user`.`account_expired`");
        if (is_array($users)) {
                        $total_users = count($users);
                        $active_users_halfyear = 0;
index 863025ccc706113b9695a2e30b2e6cbba860c64e..756091113448a5d65078d38082ec3cf4bfb8fa8f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define('UPDATE_VERSION' , 1204);
+define('UPDATE_VERSION' , 1206);
 
 /**
  *
@@ -1677,7 +1677,7 @@ function update_1190() {
                        $idx = array_search($plugin, $plugins_arr);
                        if ($idx !== false){
                                unset($plugins_arr[$idx]);
-                               //delete forumlist manually from addon and hook table 
+                               //delete forumlist manually from addon and hook table
                                // since uninstall_plugin() don't work here
                                q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
                                q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
index a9c1a67d446e474f355f3d652d747a4d0a125f04..2be7d5cb46fc997fc1e3428629d5e53132a8ec97 100644 (file)
@@ -75,6 +75,9 @@ blockquote {
 .hidden {
     display: none !important;
 }
+code {
+       white-space: pre;
+}
 
 /*
 * standard page elements