37 function system_asset_fns_create_pre_check(
Asset $asset)
41 $sql =
'SELECT COUNT(*)
42 FROM '.SQ_TABLE_RUNNING_PREFIX.
'ast
44 $where =
'type_code = :type_code';
45 $where = $GLOBALS[
'SQ_SYSTEM']->constructRollbackWhereClause($where);
52 }
catch (Exception $e) {
53 throw new Exception(
'Unable to check for existing system asset of type "'.$type_code.
'" due to database error: '.$e->getMessage());
57 trigger_localised_error(
'CORE0085', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($asset->
type(),
'name'));
74 function system_asset_fns_create_cleanup(
Asset $asset)
77 $assetids = array_keys($GLOBALS[
'SQ_SYSTEM']->am->getDependantChildren($asset->id));
78 foreach ($assetids as $assetid) {
79 foreach (Array(SQ_PERMISSION_WRITE, SQ_PERMISSION_ADMIN) as $perm) {
80 $unset_perms = $GLOBALS[
'SQ_SYSTEM']->am->getPermission($assetid, $perm, NULL, FALSE, FALSE, TRUE);
81 foreach ($unset_perms as $userid => $access) {
82 if (!$GLOBALS[
'SQ_SYSTEM']->am->deletePermission($assetid, $userid, $perm)) {