* Queue classes should use caching if they are any slower without memcached.
*
* @return bool
+ * @throws MWException
*/
final public function isEmpty() {
wfProfileIn( __METHOD__ );
* Queue classes should use caching if they are any slower without memcached.
*
* @return integer
+ * @throws MWException
*/
final public function getSize() {
wfProfileIn( __METHOD__ );
* Queue classes should use caching if they are any slower without memcached.
*
* @return integer
+ * @throws MWException
*/
final public function getAcquiredCount() {
wfProfileIn( __METHOD__ );
*
* @param $jobs Job|Array
* @param $flags integer Bitfield (supports JobQueue::QoS_Atomic)
- * @throws MWException
* @return bool Returns false on failure
+ * @throws MWException
*/
final public function push( $jobs, $flags = 0 ) {
$jobs = is_array( $jobs ) ? $jobs : array( $jobs );
*
* @param $jobs array List of Jobs
* @param $flags integer Bitfield (supports JobQueue::QoS_Atomic)
- * @throws MWException
* @return bool Returns false on failure
+ * @throws MWException
*/
final public function batchPush( array $jobs, $flags = 0 ) {
foreach ( $jobs as $job ) {
* This requires $wgJobClasses to be set for the given job type.
*
* @return Job|bool Returns false on failure
+ * @throws MWException
*/
final public function pop() {
+ global $wgJobClasses;
+
+ if ( $this->wiki !== wfWikiID() ) {
+ throw new MWException( "Cannot pop '{$this->type}' job off foreign wiki queue." );
+ } elseif ( !isset( $wgJobClasses[$this->type] ) ) {
+ // Do not pop jobs if there is no class for the queue type
+ throw new MWException( "Unrecognized job type '{$this->type}'." );
+ }
+
wfProfileIn( __METHOD__ );
$job = $this->doPop();
wfProfileOut( __METHOD__ );
* This does nothing for certain queue classes or if "claimTTL" is not set.
*
* @param $job Job
- * @throws MWException
* @return bool
+ * @throws MWException
*/
final public function ack( Job $job ) {
if ( $job->getType() !== $this->type ) {
* This does nothing for certain queue classes.
*
* @param $job Job
- * @throws MWException
* @return bool
+ * @throws MWException
*/
final public function deduplicateRootJob( Job $job ) {
if ( $job->getType() !== $this->type ) {
* This does nothing for certain queue classes.
*
* @return void
+ * @throws MWException
*/
final public function waitForBackups() {
wfProfileIn( __METHOD__ );