18 require_once SQ_CORE_PACKAGE_PATH.
'/system/cron/cron_job/cron_job.inc';
19 require_once SQ_FUDGE_PATH.
'/db_extras/db_extras.inc';
44 parent::__construct($assetid);
62 require_once SQ_CORE_PACKAGE_PATH.
'/system/system_asset_fns.inc';
63 if (!system_asset_fns_create_pre_check($this)) {
66 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
67 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
69 if ($linkid = parent::create($link)) {
70 if (!system_asset_fns_create_cleanup($this)) {
76 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
78 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
81 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
98 return $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->
type(),
'name');
129 trigger_localised_error(
'CRON0024', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
165 $assetids = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids(
'page_account_manager', FALSE);
167 foreach($assetids as $assetid) {
168 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
171 $pending_group_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($assetid, NULL,
'user_group', TRUE,
'pending_accounts');
172 if ($asset->attr(
'use_email_validation') && !empty($pending_group_link)) {
173 $pending_group = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($pending_group_link[
'minorid']);
176 $resend_period = $asset->attr(
'resend_validation_period');
177 if ($resend_period > 0) {
184 ON a.assetid = l.minorid
186 l.majorid = :majorid AND
187 l.link_type = :link_type AND
188 a.created < '.$date_sql;
196 foreach($user_assetids as $user_row) {
198 $user_assetid = $user_row[
'assetid'];
200 $resent_link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkByAsset($pending_group->id, $user_assetid, SQ_LINK_NOTICE,
'validation_email_resent');
201 if (!empty($resent_link))
continue;
203 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($user_assetid);
205 trigger_error(
"User #".$user_assetid.
" doesn't exist", E_USER_WARNING);
209 if ($asset->resendValidation($user->attr(
'username'))) $GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($pending_group, $user, SQ_LINK_NOTICE,
'validation_email_resent');
217 $remove_period = $asset->attr(
'remove_account_period');
218 if ($remove_period > 0) {
225 ON a.assetid = l.minorid
227 l.majorid = :majorid AND
228 a.created < '.$date_sql.
' AND
229 l.link_type < '.SQ_SC_LINK_SIGNIFICANT;
237 foreach($user_assetids as $user_row) {
238 $user_assetid = $user_row[
'assetid'];
239 $user_linkid = $user_row[
'linkid'];
241 $user = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($user_assetid);
243 trigger_error(
"User #".$user_assetid.
" doesn't exist", E_USER_WARNING);
246 $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($user_assetid);
251 $GLOBALS[
'SQ_PURGING_TRASH'] = TRUE;
254 $inbox_link = $user->getInboxLink();
255 $inbox = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($inbox_link[
'minorid']);
256 $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($inbox->id);
257 $inbox->updateLookups();
260 $workspace = $user->getWorkspace();
261 $GLOBALS[
'SQ_SYSTEM']->am->trashAsset($workspace->id);
262 $workspace->updateLookups();
264 $inbox->delete(
false);
265 $workspace->delete(
false);
266 unset($GLOBALS[
'SQ_PURGING_TRASH']);
269 $user->delete(
false);
280 return SQ_CRON_JOB_COMPLETED;
297 $res = parent::run();
298 if ($res & SQ_CRON_JOB_REMOVE) {
299 $res = $res - SQ_CRON_JOB_REMOVE;