jenkins-bot has submitted this change and it was merged.

Change subject: Remove APC Configuration caching
......................................................................


Remove APC Configuration caching

This is a dangerous microoptimization.

Change-Id: I94fab8822c57381d5a122b4be693d2e1b9c22b57
---
M Core/Configuration.php
1 file changed, 0 insertions(+), 82 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Core/Configuration.php b/Core/Configuration.php
index 313dec7..f599160 100644
--- a/Core/Configuration.php
+++ b/Core/Configuration.php
@@ -121,11 +121,6 @@
        public function loadConfigFromPaths( $searchPath ) {
                $paths = $this->expandSearchPathToActual( $searchPath );
 
-               if ( $this->loadConfigFromCache( $paths ) ) {
-                       // Config file loaded, nothing else to do.
-                       return;
-               }
-
                // Reset to empty set.
                $this->options = array();
 
@@ -159,9 +154,6 @@
                                }
                        }
                }
-
-               // Store the configuration to cache, if possible
-               $this->saveConfigToCache( $paths );
        }
 
        /**
@@ -193,80 +185,6 @@
         */
        public function override( $data ) {
                static::treeMerge( $this->options, $data );
-       }
-
-       /**
-        * Loads a configuration file from the cache if it is still valid (ie: 
source files have not
-        * changed)
-        *
-        * TODO: Generalize to any caching backend.
-        *
-        * @param array  $paths    Paths we read from
-        *
-        * @return bool True if the config was loaded successfully.
-        */
-       protected function loadConfigFromCache( $paths ) {
-               if ( !$this->hasApc() ) {
-                       return false;
-               }
-
-               $fileModifiedTimes = array_map( function ( $path ) {
-                       $fileModifiedTimes[] = filemtime( $path );
-               }, $paths );
-
-               // TODO: Cache the config for each installation's paths.
-               $cacheObj = apc_fetch( "smashpig-settings-{$this->viewName}", 
$success );
-
-               if ( !$success
-                       || empty( $cacheObj['configTimes'] )
-                       || empty( $cacheObj['paths'] )
-               ) {
-                       return false;
-               }
-
-               if ( implode( ':', $paths ) === $cacheObj['paths']
-                       && implode( ':', $fileModifiedTimes ) === 
$cacheObj['configTimes']
-               ) {
-                       // The cached values are valid
-                       // TODO: log safely.
-                       $this->options = $cacheObj['values'];
-                       return true;
-               }
-
-               return false;
-       }
-
-       protected function hasApc() {
-               static $useApc = null;
-               if ( $useApc === null ) {
-                       $useApc = extension_loaded( 'apc' );
-               }
-               return $useApc;
-       }
-
-       /**
-        * Saves the loaded configuration to the cache.
-        *
-        * @param array $paths Paths we read from
-        * @param string $node Node name that we're saving to cache
-        */
-       protected function saveConfigToCache( $paths ) {
-               if ( !$this->hasApc() ) {
-                       return;
-               }
-
-               $fileModifiedTimes = array_map( function ( $path ) {
-                       $fileModifiedTimes[] = filemtime( $path );
-               }, $paths );
-
-               apc_store(
-                       "smashpig-settings-{$this->viewName}",
-                       array(
-                                'paths' => implode( ':', $paths ),
-                                'configTimes' => implode( ':', 
$fileModifiedTimes ),
-                                'values' => $this->options,
-                       )
-               );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/311472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I94fab8822c57381d5a122b4be693d2e1b9c22b57
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org>
Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to