Пример #1
0
 /**
  * Delete a Swift container
  *
  * @param string $container Container name
  * @return void
  * @throws CloudFilesException
  */
 protected function deleteContainer($container)
 {
     $conn = $this->getConnection();
     // Swift proxy connection
     $this->connContainerCache->clear($container);
     // purge
     $conn->delete_container($container);
 }
Пример #2
0
 /**
  * Clear RepoGroup process cache used for finding a file
  * @param Title|null $title Title of the file or null to clear all files
  */
 public function clearCache(Title $title = null)
 {
     if ($title == null) {
         $this->cache->clear();
     } else {
         $this->cache->clear($title->getDBkey());
     }
 }
Пример #3
0
 /**
  * Pop a job off one of the job queues
  *
  * This pops a job off a queue as specified by $wgJobTypeConf and
  * updates the aggregate job queue information cache as needed.
  *
  * @param $qtype integer|string JobQueueGroup::TYPE_DEFAULT or type string
  * @param $flags integer Bitfield of JobQueueGroup::USE_* constants
  * @return Job|bool Returns false on failure
  */
 public function pop($qtype = self::TYPE_DEFAULT, $flags = 0)
 {
     if (is_string($qtype)) {
         // specific job type
         if ($flags & self::USE_PRIORITY && $this->isQueueDeprioritized($qtype)) {
             return false;
             // back off
         }
         $job = $this->get($qtype)->pop();
         if (!$job) {
             JobQueueAggregator::singleton()->notifyQueueEmpty($this->wiki, $qtype);
         }
         return $job;
     } else {
         // any job in the "default" jobs types
         if ($flags & self::USE_CACHE) {
             if (!$this->cache->has('queues-ready', 'list', self::PROC_CACHE_TTL)) {
                 $this->cache->set('queues-ready', 'list', $this->getQueuesWithJobs());
             }
             $types = $this->cache->get('queues-ready', 'list');
         } else {
             $types = $this->getQueuesWithJobs();
         }
         if ($qtype == self::TYPE_DEFAULT) {
             $types = array_intersect($types, $this->getDefaultQueueTypes());
         }
         shuffle($types);
         // avoid starvation
         foreach ($types as $type) {
             // for each queue...
             if ($flags & self::USE_PRIORITY && $this->isQueueDeprioritized($type)) {
                 continue;
                 // back off
             }
             $job = $this->get($type)->pop();
             if ($job) {
                 // found
                 return $job;
             } else {
                 // not found
                 JobQueueAggregator::singleton()->notifyQueueEmpty($this->wiki, $type);
                 $this->cache->clear('queues-ready');
             }
         }
         return false;
         // no jobs found
     }
 }
Пример #4
0
 /**
  * @see FileBackend::clearCache()
  */
 public final function clearCache(array $paths = null)
 {
     if (is_array($paths)) {
         $paths = array_map('FileBackend::normalizeStoragePath', $paths);
         $paths = array_filter($paths, 'strlen');
         // remove nulls
     }
     if ($paths === null) {
         $this->cheapCache->clear();
         $this->expensiveCache->clear();
     } else {
         foreach ($paths as $path) {
             $this->cheapCache->clear($path);
             $this->expensiveCache->clear($path);
         }
     }
     $this->doClearCache($paths);
 }
Пример #5
0
 /**
  * Pop a job off one of the job queues
  *
  * This pops a job off a queue as specified by $wgJobTypeConf and
  * updates the aggregate job queue information cache as needed.
  *
  * @param int|string $qtype JobQueueGroup::TYPE_* constant or job type string
  * @param int $flags Bitfield of JobQueueGroup::USE_* constants
  * @param array $blacklist List of job types to ignore
  * @return Job|bool Returns false on failure
  */
 public function pop($qtype = self::TYPE_DEFAULT, $flags = 0, array $blacklist = array())
 {
     $job = false;
     if (is_string($qtype)) {
         // specific job type
         if (!in_array($qtype, $blacklist)) {
             $job = $this->get($qtype)->pop();
             if (!$job) {
                 JobQueueAggregator::singleton()->notifyQueueEmpty($this->wiki, $qtype);
             }
         }
     } else {
         // any job in the "default" jobs types
         if ($flags & self::USE_CACHE) {
             if (!$this->cache->has('queues-ready', 'list', self::PROC_CACHE_TTL)) {
                 $this->cache->set('queues-ready', 'list', $this->getQueuesWithJobs());
             }
             $types = $this->cache->get('queues-ready', 'list');
         } else {
             $types = $this->getQueuesWithJobs();
         }
         if ($qtype == self::TYPE_DEFAULT) {
             $types = array_intersect($types, $this->getDefaultQueueTypes());
         }
         $types = array_diff($types, $blacklist);
         // avoid selected types
         shuffle($types);
         // avoid starvation
         foreach ($types as $type) {
             // for each queue...
             $job = $this->get($type)->pop();
             if ($job) {
                 // found
                 break;
             } else {
                 // not found
                 JobQueueAggregator::singleton()->notifyQueueEmpty($this->wiki, $type);
                 $this->cache->clear('queues-ready');
             }
         }
     }
     return $job;
 }
Пример #6
0
 /**
  * Clear the cache for slag lag delay times
  */
 public function clearLagTimeCache()
 {
     $this->mProcCache->clear('slave_lag');
 }