Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezpcontentpublishingqueue.php
Go to the documentation of this file.
1 <?php
19 class ezpContentPublishingQueue implements ezpContentPublishingQueueReaderInterface
20 {
26 public static function signals()
27 {
28 if ( self::$signals == null )
29 {
30 self::$signals = new ezcSignalCollection();
31 }
32 return self::$signals;
33 }
34
38 protected final static function initHooks()
39 {
40 if ( isset( $init ) )
41 return;
42
43 static $init = true;
44
45 $ini = eZINI::instance( 'content.ini' );
46
47 self::attachHooks( 'preQueue', $ini->variable( 'PublishingSettings', 'AsynchronousPublishingPreQueueHooks' ) );
48 self::attachHooks( 'postHandling', $ini->variable( 'PublishingSettings', 'AsynchronousPublishingPostHandlingHooks' ) );
49 }
50
51 public static function init()
52 {
53 self::initHooks();
54 }
55
62 protected final static function attachHooks( $connector, $hooksList )
63 {
64 if ( is_array( $hooksList ) && count( $hooksList ) )
65 {
66 foreach( $hooksList as $hook )
67 {
68 self::signals()->connect( $connector, $hook );
69 }
70 }
71 }
72
81 public static function add( $objectId, $version )
82 {
83 self::init();
84 self::signals()->emit( 'preQueue', $version, $objectId );
85 $processObject = ezpContentPublishingProcess::queue( eZContentObjectVersion::fetchVersion( $version, $objectId ) );
86
87 return $processObject;
88 }
89
96 public static function isQueued( $objectId, $version )
97 {
98 $process = ezpContentPublishingProcess::fetchByContentObjectVersion( $objectId, $version );
99 return ( $process instanceof ezpContentPublishingProcess );
100 }
101
106 public static function next()
107 {
108 return self::getNextItem();
109 }
110
115 protected static $signals = null;
116
121 private static function getNextItem()
122 {
123 $pendingStatusValue = ezpContentPublishingProcess::STATUS_PENDING;
124 $workingStatusValue = ezpContentPublishingProcess::STATUS_WORKING;
125
126 $sql = <<< SQL
127 SELECT *
128 FROM
129 ezpublishingqueueprocesses p,
130 ezcontentobject_version v
131 WHERE p.status = $pendingStatusValue
132 AND p.ezcontentobject_version_id = v.id
133 AND v.contentobject_id NOT IN (
134 SELECT v.contentobject_id
135 FROM ezpublishingqueueprocesses p,
136 ezcontentobject_version v
137 WHERE
138 p.ezcontentobject_version_id = v.id
139 AND p.status = $workingStatusValue
140 )
141 ORDER BY p.created, p.ezcontentobject_version_id ASC
142 SQL;
143 $db = eZDB::instance();
144 $rows = $db->arrayQuery( $sql, array( 'offset' => 0, 'limit' => 1 ) );
145 if ( count( $rows ) == 0 )
146 return false;
147
149 $persistentObjects = eZPersistentObject::handleRows( $rows, 'ezpContentPublishingProcess', true );
150 return $persistentObjects[0];
151 }
152
153 }
154 ?>
eZPersistentObject\handleRows
static handleRows( $rows, $class_name, $asObject)
Definition: ezpersistentobject.php:964
$ini
$ini
Definition: classes/admin/linklist.php:64
ezpContentPublishingProcess
Definition: ezpcontentpublishingprocess.php:19
ezpContentPublishingProcess\STATUS_PENDING
const STATUS_PENDING
Definition: ezpcontentpublishingprocess.php:22
ezpContentPublishingProcess\STATUS_WORKING
const STATUS_WORKING
Definition: ezpcontentpublishingprocess.php:20
ezpContentPublishingProcess\queue
static queue(eZContentObjectVersion $version)
Definition: ezpcontentpublishingprocess.php:280
ezpContentPublishingProcess\fetchByContentObjectVersion
static fetchByContentObjectVersion( $contentObjectId, $version)
Definition: ezpcontentpublishingprocess.php:109
ezpContentPublishingQueue
Definition: ezpcontentpublishingqueue.php:20
ezpContentPublishingQueue\initHooks
static initHooks()
Definition: ezpcontentpublishingqueue.php:38
ezpContentPublishingQueue\next
static next()
Definition: ezpcontentpublishingqueue.php:106
ezpContentPublishingQueue\init
static init()
Definition: ezpcontentpublishingqueue.php:51
ezpContentPublishingQueue\attachHooks
static attachHooks( $connector, $hooksList)
Definition: ezpcontentpublishingqueue.php:62
ezpContentPublishingQueue\signals
static signals()
Definition: ezpcontentpublishingqueue.php:26
ezpContentPublishingQueue\add
static add( $objectId, $version)
Definition: ezpcontentpublishingqueue.php:81
ezpContentPublishingQueue\isQueued
static isQueued( $objectId, $version)
Definition: ezpcontentpublishingqueue.php:96
ezpContentPublishingQueue\$signals
static $signals
Definition: ezpcontentpublishingqueue.php:115
$version
$version
Definition: ezabout/user/datasupplier.php:29
$db
$db
Definition: ezarticle/user/authorlist.php:53
$rows
$rows
Definition: frontpage.php:128
ezpContentPublishingQueueReaderInterface
Definition: ezpcontentpublishingqueuereader.php:19
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.