]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Core and Default plugins separated, now loads on install
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 19 Oct 2013 12:35:04 +0000 (14:35 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 19 Oct 2013 12:38:15 +0000 (14:38 +0200)
_flow_ reported on IRC that install.php had stopped working. This was
because default plugins had been put into two separate lists, and the
list with AuthCrypt was never loaded when performing an installation.

Core plugins cannot be disabled.

I also removed the Memcache autodetection thing since it should be
solved in a more elegant manner.

classes/User.php
lib/default.php
lib/installer.php
lib/siteprofile.php
lib/statusnet.php

index 48767f46d93d4860ae389891b02439a3d28bacef..aaf5f91526e778e5ad78668e886b50198ec88f89 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Table Definition for user
  */
 
-require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
-require_once 'Validate.php';
-
 class User extends Managed_DataObject
 {
     const SUBSCRIBE_POLICY_OPEN = 0;
@@ -233,7 +228,7 @@ class User extends Managed_DataObject
         try {
             $profile->nickname = Nickname::normalize($nickname, true);
         } catch (NicknameException $e) {
-            common_log(LOG_WARNING, sprintf('Bad nickname during User registration for %s: %s', $profile->nickname, $e->getMessage()), __FILE__);
+            common_log(LOG_WARNING, sprintf('Bad nickname during User registration for %s: %s', $nickname, $e->getMessage()), __FILE__);
             return false;
         }
 
@@ -305,7 +300,7 @@ class User extends Managed_DataObject
             $profile->query('BEGIN');
 
             $id = $profile->insert();
-            if (empty($id)) {
+            if ($id === false) {
                 common_log_db_error($profile, 'INSERT', __FILE__);
                 return false;
             }
@@ -324,7 +319,7 @@ class User extends Managed_DataObject
 
             $result = $user->insert();
 
-            if (!$result) {
+            if ($result === false) {
                 common_log_db_error($user, 'INSERT', __FILE__);
                 $profile->query('ROLLBACK');
                 return false;
index 68b4518bfaa73d2c1b28bfe6332447cfdb50e78f..fd505cd4c2a5931a5371cba25d3e25376f2e347d 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Config
- * @package   StatusNet
+ * @package   GNUsocial
  * @author    Evan Prodromou <evan@status.net>
  * @copyright 2008-9 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://status.net/
+ * @link      http://www.gnu.org/software/social/
  */
 
 $default =
     array('site' =>
-        array('name' => 'Just another StatusNet microblog',
-              'nickname' => 'statusnet',
+        array('name' => 'Just another GNU social node',
+              'nickname' => 'gnusocial',
               'wildcard' => null,
               'server' => $_server,
               'theme' => 'neo',
@@ -305,19 +305,22 @@ $default =
         'logincommand' =>
         array('disabled' => true),
         'plugins' =>
-        array('default' => array('Geonames' => null,
-                                 'ClientSideShorten' => null,
-                                 'StrictTransportSecurity' => null,
-                                 'Bookmark' => null,
-                                 'Event' => null,
-                                 'Poll' => null,
-                                 'QnA' => null,
-                                 'SearchSub' => null,
-                                 'TagSub' => null,
-                                 'OpenID' => null,
-                                 'Directory' => null,
-                                 'ExtendedProfile' => null,
-                                 'Activity' => null),
+        array('core' => array(
+                            'AuthCrypt' => null,
+                            'LRDD' => null,
+                            'StrictTransportSecurity' => null,
+                        ),
+              'default' => array(
+                            'Activity' => null,
+                            'Bookmark' => null,
+                            'ClientSideShorten' => null,
+                            'Event' => null,
+                            'OpenID' => null,
+                            'Poll' => null,
+                            'QnA' => null,
+                            'SearchSub' => null,
+                            'TagSub' => null,
+                        ),
               'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
               'server' => null,
               'sslserver' => null,
index bfe8c5259fbf447c2d518dbbeda2b2c37aa9b280..a8f3e31a45db47a9ea4401b182c82c1d955167b2 100644 (file)
@@ -438,16 +438,6 @@ abstract class Installer
                 ($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":'').
                 "\$config['db']['type'] = {$vals['db_type']};\n\n";
 
-        // Auto memcache support detection
-        $cfg .= '
-foreach(array("Memcache", "Memcached") as $plugin) :
-    if (class_exists($plugin)) {
-        addPlugin($plugin);
-        break;
-    }
-endforeach;
-';
-
         // Normalize line endings for Windows servers
         $cfg = str_replace("\n", PHP_EOL, $cfg);
 
@@ -618,7 +608,7 @@ endforeach;
                 );
             } else {
                 $this->updateStatus(
-                    "Could not create initial StatusNet user (administrator).",
+                    "Could not create initial GNU social user.",
                     true
                 );
                 return false;
index 86ef13b5506544b8a73e541c6df575f420f9691f..420b4f3e93f890cb8ff0847eb34ee7e3c62e4c27 100644 (file)
@@ -79,18 +79,8 @@ abstract class SiteProfileSettings
     }
 
     static function defaultPlugins() {
-        return array(
-            'AuthCrypt'               => null,
-            'Bookmark'                => null,
-            'Event'                   => null,
-            'OpenID'                  => null,
-            'LRDD'                    => null,
-            'Poll'                    => null,
-            'QnA'                     => null,
-            'SearchSub'               => null,
-            'StrictTransportSecurity' => null,
-            'TagSub'                  => null,
-        );
+        return array_merge(common_config('plugins', 'core'),
+                           common_config('plugins', 'default'));
     }
 }
 
@@ -117,7 +107,6 @@ class PublicSite extends SiteProfileSettings
             ),
             'plugins' => array(
                 'default' => array_merge(self::defaultPlugins(), array(
-                    'ClientSideShorten'       => null,
                     'Directory'               => null,
                     'ExtendedProfile'         => null,
                     'Geonames'                => null,
@@ -154,7 +143,6 @@ class PrivateSite extends SiteProfileSettings
             ),
             'plugins' => array(
                 'default' => array_merge(self::defaultPlugins(), array(
-                    'ClientSideShorten'       => null,
                     'Directory'               => null,
                     'ExtendedProfile'         => null,
                     'EmailRegistration'       => null,
@@ -207,7 +195,6 @@ class CommunitySite extends SiteProfileSettings
             ),
             'plugins' => array(
                 'default' => array_merge(self::defaultPlugins(), array(
-                    'ClientSideShorten'       => null,
                     'Directory'               => null,
                     'Geonames'                => null,
                     'OStatus'                 => null,
@@ -243,7 +230,6 @@ class SingleuserSite extends SiteProfileSettings
             ),
             'plugins' => array(
                 'default' => array_merge(self::defaultPlugins(), array(
-                    'ClientSideShorten'       => null,
                     'Geonames'                => null,
                     'NewMenu'                 => null,
                     'MobileProfile'           => null,
index 14b57ea052799ccd58ddfbc81296a2d4202da59d..0a15d3b5251099b927b970743764908c44ea0cfa 100644 (file)
@@ -181,6 +181,11 @@ class StatusNet
      */
     protected static function initPlugins()
     {
+        // Load core plugins
+        foreach (common_config('plugins', 'core') as $name => $params) {
+            call_user_func('addPlugin', $name, $params);
+        }
+
         // Load default plugins
         foreach (common_config('plugins', 'default') as $name => $params) {
             $key = 'disable-' . $name;