16 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
17 require_once SQ_CORE_PACKAGE_PATH.
'/system/triggers/trigger_action/trigger_action.inc';
53 public static function execute($settings, &$state)
55 if (empty($state[
'asset'])) {
57 if (empty($state[
'assetid'])) {
60 $state[
'asset'] = &$GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
63 if (is_null($state[
'asset']))
return FALSE;
65 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
66 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
70 $bind_vars = Array(
'assetid' => (
string) $state[
'assetid']);
72 }
catch (Exception $e) {
73 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
74 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
75 throw new Exception(
'Unable to reset hit count due to database error: '.$e->getMessage());
79 if (!empty($asset_hit_count)) {
81 $bind_vars = Array(
'assetid' => (
string) $state[
'assetid']);
83 }
catch (Exception $e) {
84 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
85 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
86 throw new Exception(
'Unable to decrement hit count due to database error: '.$e->getMessage());
90 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
91 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
106 public static function getInterface($settings, $prefix, $write_access=FALSE)
142 public static function getLocks($settings, &$state)
144 return Array($state[
'assetid'] => Array(
'lookups'));