Merge "clone is not a function"
[lhc/web/wiklou.git] / includes / jobqueue / JobQueueGroup.php
index 72d2537..5bd1cc9 100644 (file)
@@ -28,7 +28,7 @@
  * @since 1.21
  */
 class JobQueueGroup {
-       /** @var array */
+       /** @var JobQueueGroup[] */
        protected static $instances = array();
 
        /** @var ProcessCacheLRU */
@@ -166,10 +166,11 @@ class JobQueueGroup {
         * @return void
         * @since 1.26
         */
-       public function pushLazyJobs() {
-               $this->push( $this->bufferedJobs );
-
-               $this->bufferedJobs = array();
+       public static function pushLazyJobs() {
+               foreach ( self::$instances as $group ) {
+                       $group->push( $group->bufferedJobs );
+                       $group->bufferedJobs = array();
+               }
        }
 
        /**
@@ -415,8 +416,8 @@ class JobQueueGroup {
        function __destruct() {
                $n = count( $this->bufferedJobs );
                if ( $n > 0 ) {
-                       trigger_error( __METHOD__ . ": $n buffered job(s) never inserted." );
-                       $this->pushLazyJobs(); // try to do it now
+                       $type = implode( ', ', array_unique( array_map( 'get_class', $this->bufferedJobs ) ) );
+                       trigger_error( __METHOD__ . ": $n buffered job(s) of type(s) $type never inserted." );
                }
        }
 }