Allow to disable specific groups in $wgDebugLogGroups
[lhc/web/wiklou.git] / includes / site / SiteSQLStore.php
index 4123805..11141e0 100644 (file)
@@ -188,6 +188,39 @@ class SiteSQLStore implements SiteStore {
                return $site;
        }
 
+       /**
+        * Get a new ORMRow from a Site object
+        *
+        * @since 1.22
+        *
+        * @param Site
+        *
+        * @return ORMRow
+        */
+       protected function getRowFromSite( Site $site ) {
+               $fields = array(
+                       // Site data
+                       'global_key' => $site->getGlobalId(), // TODO: check not null
+                       'type' => $site->getType(),
+                       'group' => $site->getGroup(),
+                       'source' => $site->getSource(),
+                       'language' => $site->getLanguageCode() === null ? '' : $site->getLanguageCode(),
+                       'protocol' => $site->getProtocol(),
+                       'domain' => strrev( $site->getDomain() ) . '.',
+                       'data' => $site->getExtraData(),
+
+                       // Site config
+                       'forward' => $site->shouldForward(),
+                       'config' => $site->getExtraConfig(),
+               );
+
+               if ( $site->getInternalId() !== null ) {
+                       $fields['id'] = $site->getInternalId();
+               }
+
+               return new ORMRow( $this->sitesTable, $fields );
+       }
+
        /**
         * Fetches the site from the database and loads them into the sites field.
         *
@@ -291,28 +324,11 @@ class SiteSQLStore implements SiteStore {
                $localIds = array();
 
                foreach ( $sites as $site ) {
-                       $fields = array(
-                               // Site data
-                               'global_key' => $site->getGlobalId(), // TODO: check not null
-                               'type' => $site->getType(),
-                               'group' => $site->getGroup(),
-                               'source' => $site->getSource(),
-                               'language' => $site->getLanguageCode() === null ? '' : $site->getLanguageCode(),
-                               'protocol' => $site->getProtocol(),
-                               'domain' => strrev( $site->getDomain() ) . '.',
-                               'data' => $site->getExtraData(),
-
-                               // Site config
-                               'forward' => $site->shouldForward(),
-                               'config' => $site->getExtraConfig(),
-                       );
-
                        if ( $site->getInternalId() !== null ) {
-                               $fields['id'] = $site->getInternalId();
                                $internalIds[] = $site->getInternalId();
                        }
 
-                       $siteRow = new ORMRow( $this->sitesTable, $fields );
+                       $siteRow = $this->getRowFromSite( $site );
                        $success = $siteRow->save( __METHOD__ ) && $success;
 
                        foreach ( $site->getLocalIds() as $idType => $ids ) {