/**
  * Construct the MailController
  *
  * @access public
  * @param void
  * @return MailController
  */
 function __construct()
 {
     parent::__construct();
     prepare_company_website_controller($this, 'website');
     Env::useHelper('MailUtilities.class', $this->plugin_name);
     require_javascript("AddMail.js", $this->plugin_name);
 }
Beispiel #2
0
 function purge_trash()
 {
     Env::useHelper("permissions");
     $days = config_option("days_on_trash", 0);
     $count = 0;
     if ($days > 0) {
         $date = DateTimeValueLib::now()->add("d", -$days);
         $objects = Objects::findAll(array("conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
         foreach ($objects as $object) {
             $concrete_object = Objects::findObject($object->getId());
             if (!$concrete_object instanceof ContentDataObject) {
                 continue;
             }
             if ($concrete_object instanceof MailContent && $concrete_object->getIsDeleted() > 0) {
                 continue;
             }
             try {
                 DB::beginWork();
                 if ($concrete_object instanceof MailContent) {
                     $concrete_object->delete(false);
                 } else {
                     $concrete_object->delete();
                 }
                 ApplicationLogs::createLog($concrete_object, ApplicationLogs::ACTION_DELETE);
                 DB::commit();
                 $count++;
             } catch (Exception $e) {
                 DB::rollback();
                 Logger::log("Error delting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
             }
         }
     }
     return $count;
 }
Beispiel #3
0
function send_reminders() {
	_log("Sending reminders...");
	Env::useHelper('permissions');
	$sent = 0;
	$ors = ObjectReminders::getDueReminders();
	foreach ($ors as $or) {
		$function = $or->getType();
		try {
			$ret = 0;
			Hook::fire($function, $or, $ret);
			$sent += $ret;
		} catch (Exception $ex) {
			_log("Error sending reminder: " . $ex->getMessage());
		}
	}
	_log("$sent reminders sent.");
}
Beispiel #4
0
 function purge_trash()
 {
     Env::useHelper("permissions");
     $days = config_option("days_on_trash", 0);
     $count = 0;
     if ($days > 0) {
         $date = DateTimeValueLib::now()->add("d", -$days);
         $managers = array('Comments', 'Companies', 'Contacts', 'MailContents', 'ProjectCharts', 'ProjectEvents', 'ProjectFiles', 'ProjectFileRevisions', 'ProjectForms', 'ProjectMessages', 'ProjectMilestones', 'ProjectTasks', 'ProjectWebpages');
         foreach ($managers as $manager_class) {
             $manager = new $manager_class();
             $prevcount = -1;
             while ($prevcount != $count) {
                 $prevcount = $count;
                 if ($manager_class == 'MailContents') {
                     $objects = $manager->findAll(array("include_trashed" => true, "conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ? AND `is_deleted` = 0", $date), "limit" => 100));
                 } else {
                     $objects = $manager->findAll(array("include_trashed" => true, "conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
                 }
                 if (is_array($objects)) {
                     // delete one by one because each one knows what else to delete
                     foreach ($objects as $o) {
                         try {
                             DB::beginWork();
                             $ws = $o->getWorkspaces();
                             if ($o instanceof MailContent) {
                                 $o->delete(false);
                             } else {
                                 $o->delete();
                             }
                             ApplicationLogs::createLog($o, $ws, ApplicationLogs::ACTION_DELETE);
                             DB::commit();
                             $count++;
                         } catch (Exception $e) {
                             DB::rollback();
                             Logger::log("Error deleting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
                         }
                     }
                 }
             }
         }
     }
     return $count;
 }
<?php

chdir(dirname(__FILE__));
header("Content-type: text/plain");
define("CONSOLE_MODE", true);
include "init.php";
Env::useHelper('format');
define('SCRIPT_MEMORY_LIMIT', 1024 * 1024 * 1024);
// 1 GB
@set_time_limit(0);
ini_set('memory_limit', SCRIPT_MEMORY_LIMIT / (1024 * 1024) + 50 . 'M');
$i = 0;
$objects_ids = Objects::instance()->findAll(array('columns' => array('id'), 'id' => true));
//,'conditions' => 'object_type_id = 6'
echo "\nObjects to process: " . count($objects_ids) . "\n-----------------------------------------------------------------";
foreach ($objects_ids as $object_id) {
    $object = Objects::findObject($object_id);
    $i++;
    if ($object instanceof ContentDataObject) {
        $members = $object->getMembers();
        DB::execute("DELETE FROM " . TABLE_PREFIX . "object_members WHERE object_id = " . $object->getId() . " AND is_optimization = 1;");
        ObjectMembers::addObjectToMembers($object->getId(), $members);
    } else {
        //
    }
    if ($i % 100 == 0) {
        echo "\n{$i} objects processed. Mem usage: " . format_filesize(memory_get_usage(true));
    }
}
 /**
  * After drag and drop
  */
 function add_default_permissions()
 {
     ajx_current("empty");
     $mem_id = array_var($_REQUEST, 'member_id');
     $user_ids = explode(',', array_var($_REQUEST, 'user_ids'));
     foreach ($user_ids as $k => &$uid) {
         if (!is_numeric($uid)) {
             unset($user_ids[$k]);
         }
     }
     if (can_manage_security(logged_user()) && is_numeric($mem_id)) {
         $member = Members::findById($mem_id);
         $users = Contacts::findAll(array('conditions' => 'id IN (' . implode(',', $user_ids) . ')'));
         if ($member instanceof Member && is_array($users) && count($users) > 0) {
             $permissions_decoded = array();
             foreach ($users as $user) {
                 $role_perms = RoleObjectTypePermissions::findAll(array('conditions' => array("role_id=?", $user->getUserType())));
                 foreach ($role_perms as $role_perm) {
                     $pg_obj = new stdClass();
                     $pg_obj->pg = $user->getPermissionGroupId();
                     $pg_obj->o = $role_perm->getObjectTypeId();
                     $pg_obj->d = $role_perm->getCanDelete();
                     $pg_obj->w = $role_perm->getCanWrite();
                     $pg_obj->r = 1;
                     $permissions_decoded[] = $pg_obj;
                 }
             }
             $permissions = json_encode($permissions_decoded);
             Env::useHelper('permissions');
             try {
                 DB::beginWork();
                 save_member_permissions_background(logged_user(), $member, $permissions);
                 DB::commit();
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
             }
         }
     }
 }
 /**
  * Send task due notification to the list of users ($people)
  *
  * @param ProjectTask $task Due task
  * @param array $people
  * @return boolean
  * @throws NotifierConnectionError
  */
 static function objectReminder(ObjectReminder $reminder)
 {
     $object = $reminder->getObject();
     $context = $reminder->getContext();
     $type = $object->getObjectTypeName();
     $date = $object->getColumnValue($context);
     $several_event_subscribers = false;
     Env::useHelper("format");
     $isEvent = $object instanceof ProjectEvent ? true : false;
     if ($reminder->getUserId() == 0) {
         $people = $object->getSubscribers();
         if ($isEvent) {
             $several_event_subscribers = true;
             $aux = array();
             foreach ($people as $person) {
                 //grouping people by different timezone
                 $time = $person->getTimezone();
                 if (isset($aux["{$time}"])) {
                     $aux["{$time}"][] = $person;
                 } else {
                     $aux["{$time}"] = array($person);
                 }
             }
             foreach ($aux as $tz => $group) {
                 $string_date = format_datetime($date, 0, $tz);
                 self::objectNotification($object, $group, null, "{$context} reminder", "{$context} {$type} reminder desc");
             }
         }
     } else {
         $people = array($reminder->getUser());
         if ($isEvent) {
             $string_date = format_datetime($date, 0, $reminder->getUser()->getTimezone());
         } else {
             $string_date = $date->format("Y/m/d H:i:s");
         }
     }
     if (!$several_event_subscribers) {
         if (!isset($string_date)) {
             $string_date = format_datetime($date);
         }
         self::objectNotification($object, $people, null, "{$context} reminder", "{$context} {$type} reminder desc");
     }
 }
 function getmails($accounts = null, &$err, &$succ, &$errAccounts, &$mailsReceived, $maxPerAccount = 0)
 {
     Env::useHelper('permissions');
     Env::useHelper('format');
     if (is_null($accounts)) {
         $accounts = MailAccounts::findAll();
     }
     if (config_option('max_email_fetch') && ($maxPerAccount == 0 || config_option('max_email_fetch') < $maxPerAccount)) {
         $maxPerAccount = config_option('max_email_fetch');
     }
     $old_memory_limit = ini_get('memory_limit');
     if (php_config_value_to_bytes($old_memory_limit) < 192 * 1024 * 1024) {
         ini_set('memory_limit', '192M');
     }
     $err = 0;
     $succ = 0;
     $errAccounts = array();
     $mailsReceived = 0;
     if (isset($accounts)) {
         foreach ($accounts as $account) {
             if (!$account->getServer()) {
                 continue;
             }
             try {
                 $lastChecked = $account->getLastChecked();
                 $minutes = 5;
                 if ($lastChecked instanceof DateTimeValue && $lastChecked->getTimestamp() + $minutes * 60 >= DateTimeValueLib::now()->getTimestamp()) {
                     $succ++;
                     continue;
                 } else {
                     try {
                         DB::beginWork();
                         $account->setLastChecked(DateTimeValueLib::now());
                         $account->save();
                         DB::commit();
                     } catch (Exception $ex) {
                         DB::rollback();
                         $errAccounts[$err]["accountName"] = $account->getEmail();
                         $errAccounts[$err]["message"] = $e->getMessage();
                         $err++;
                     }
                 }
                 $accId = $account->getId();
                 $emails = array();
                 if (!$account->getIsImap()) {
                     $mailsReceived += self::getNewPOP3Mails($account, $maxPerAccount);
                 } else {
                     $mailsReceived += self::getNewImapMails($account, $maxPerAccount);
                 }
                 $account->setLastChecked(EMPTY_DATETIME);
                 $account->save();
                 //					self::cleanCheckingAccountError($account);
                 $succ++;
             } catch (Exception $e) {
                 $account->setLastChecked(EMPTY_DATETIME);
                 $account->save();
                 $errAccounts[$err]["accountName"] = $account->getEmail();
                 $errAccounts[$err]["message"] = $e->getMessage();
                 $err++;
                 //					self::setErrorCheckingAccount($account, $e);
             }
         }
     }
     ini_set('memory_limit', $old_memory_limit);
     tpl_assign('err', $err);
     tpl_assign('errAccounts', $errAccounts);
     tpl_assign('accounts', $accounts);
     tpl_assign('mailsReceived', $mailsReceived);
 }
 /**
  * Add one or many helpers
  *
  * @param string $helper This param can be array of helpers
  * @return null
  */
 function addHelper($helper, $controller_name = null)
 {
     trace(__FILE__, "addHelper({$helper}, {$controller_name})");
     if (!in_array($helper, $this->helpers)) {
         if (Env::useHelper($helper, $controller_name)) {
             $this->helpers[] = $helper;
         }
         // if
     }
     // if
     return true;
 }
 /**
  * Construct the ReportingController
  *
  * @access public
  * @param void
  * @return ReportingController
  */
 function __construct()
 {
     parent::__construct();
     prepare_company_website_controller($this, 'website');
     Env::useHelper('grouping');
 }
 private static function generateErrorMessage($error_code)
 {
     Env::useHelper('format');
     switch ($error_code) {
         case UPLOAD_ERR_INI_SIZE:
             return lang('upload error msg UPLOAD_ERR_INI_SIZE', format_filesize(get_max_upload_size()));
         case UPLOAD_ERR_FORM_SIZE:
             return lang('upload error msg UPLOAD_ERR_FORM_SIZE', format_filesize(get_max_upload_size()));
         case UPLOAD_ERR_PARTIAL:
             return lang('upload error msg UPLOAD_ERR_PARTIAL');
         case UPLOAD_ERR_NO_FILE:
             return lang('upload error msg UPLOAD_ERR_NO_FILE');
         case UPLOAD_ERR_NO_TMP_DIR:
             return lang('upload error msg UPLOAD_ERR_NO_TMP_DIR');
         case UPLOAD_ERR_CANT_WRITE:
             return lang('upload error msg UPLOAD_ERR_CANT_WRITE');
         case UPLOAD_ERR_EXTENSION:
             return lang('upload error msg UPLOAD_ERR_EXTENSION');
         default:
             return lang('error upload file');
     }
 }
 /**
  * Add one or many helpers
  *
  * @param string $helper This param can be array of helpers
  * @return null
  */
 function addHelper($helper)
 {
     $args = func_get_args();
     if (!is_array($args)) {
         return false;
     }
     foreach ($args as $helper) {
         if (!in_array($helper, $this->helpers)) {
             if (Env::useHelper($helper)) {
                 $this->helpers[] = $helper;
             }
         }
         // if
     }
     // foreach
     return true;
 }
<?php

chdir($argv[1]);
define("CONSOLE_MODE", true);
define('PUBLIC_FOLDER', 'public');
include "init.php";
session_commit();
// we don't need sessions
@set_time_limit(0);
// don't limit execution of cron, if possible
ini_set('memory_limit', '1024M');
Env::useHelper('permissions');
$user_id = array_var($argv, 2);
$token = array_var($argv, 3);
// log user in
$user = Contacts::findById($user_id);
if (!$user instanceof Contact || !$user->isValidToken($token)) {
    die;
}
CompanyWebsite::instance()->setLoggedUser($user, false, false, false);
// get parameters
$member_id = array_var($argv, 4);
$old_parent_id = array_var($argv, 5);
// execute the permissions rebuild
try {
    DB::beginWork();
    do_member_parent_changed_refresh_object_permisssions($member_id, $old_parent_id);
    DB::commit();
} catch (Exception $e) {
    Logger::log("ERROR updating permissions after changing member parent for member ({$member_id})");
    DB::rollback();
 /**
  * Adds the custom properties of an object into the database.
  * 
  * @param $object
  * @return unknown_type
  */
 function add_custom_properties($object)
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $obj_custom_properties = array_var($_POST, 'object_custom_properties');
     if (is_array($obj_custom_properties)) {
         foreach ($obj_custom_properties as $id => &$val) {
             $val = remove_scripts($val);
         }
     }
     $date_format = user_config_option('date_format');
     $date_format_tip = date_format_tip($date_format);
     $required_custom_props = array();
     $object_type_id = $object instanceof TemplateTask ? ProjectTasks::instance()->getObjectTypeId() : $object->getObjectTypeId();
     $customProps = CustomProperties::getAllCustomPropertiesByObjectType($object_type_id);
     //Sets all boolean custom properties to 0. If any boolean properties are returned, they are subsequently set to 1.
     foreach ($customProps as $cp) {
         if ($cp->getType() == 'boolean') {
             $custom_property_value = CustomPropertyValues::getCustomPropertyValue($object->getId(), $cp->getId());
             if (!$custom_property_value instanceof CustomPropertyValue) {
                 $custom_property_value = new CustomPropertyValue();
             }
             $custom_property_value->setObjectId($object->getId());
             $custom_property_value->setCustomPropertyId($cp->getId());
             $custom_property_value->setValue(0);
             $custom_property_value->save();
         }
         if ($cp->getIsRequired()) {
             $required_custom_props[] = $cp;
         }
     }
     foreach ($required_custom_props as $req_cp) {
         if (!isset($obj_custom_properties[$req_cp->getId()])) {
             throw new Exception(lang('custom property value required', $req_cp->getName()));
         }
     }
     if (is_array($obj_custom_properties)) {
         // check required custom properties
         foreach ($obj_custom_properties as $id => $value) {
             //Get the custom property
             $custom_property = null;
             foreach ($customProps as $cp) {
                 if ($cp->getId() == $id) {
                     $custom_property = $cp;
                     break;
                 }
             }
             if ($custom_property instanceof CustomProperty) {
                 // save dates in standard format "Y-m-d H:i:s", because the column type is string
                 if ($custom_property->getType() == 'date') {
                     if (is_array($value)) {
                         $newValues = array();
                         foreach ($value as $val) {
                             if (trim($val) != '' && trim($val) != $date_format_tip) {
                                 $dtv = DateTimeValueLib::dateFromFormatAndString($date_format, $val);
                                 $newValues[] = $dtv->format("Y-m-d H:i:s");
                             }
                         }
                         $value = $newValues;
                     } else {
                         if (trim($value) != '' && trim($val) != $date_format_tip) {
                             $dtv = DateTimeValueLib::dateFromFormatAndString($date_format, $value);
                             $value = $dtv->format("Y-m-d H:i:s");
                         } else {
                             $value = '';
                         }
                     }
                 }
                 foreach (array_var($_REQUEST, 'remove_custom_properties', array()) as $cpropid => $remove) {
                     if ($remove) {
                         CustomPropertyValues::deleteCustomPropertyValues($object->getId(), $cpropid);
                     }
                 }
                 Hook::fire('before_save_custom_property_value', array('custom_prop' => $custom_property), $value);
                 if (is_array($value)) {
                     if ($custom_property->getType() == 'address') {
                         if ($custom_property->getIsRequired()) {
                             if (array_var($value, 'street') == '' && array_var($value, 'city') == '' && array_var($value, 'state') == '' && array_var($value, 'country') == '' && array_var($value, 'zip_code') == '') {
                                 throw new Exception(lang('custom property value required', $custom_property->getName()));
                             }
                             $errors = array(lang('error form validation'));
                             Env::useHelper('form');
                             $ok = checkAddressInputMandatoryFields($value, $custom_property->getName(), $errors);
                             if (!$ok) {
                                 throw new Exception(implode("\n - ", $errors));
                             }
                         }
                         // Address custom property
                         $val = array_var($value, 'type') . '|' . array_var($value, 'street') . '|' . array_var($value, 'city') . '|' . array_var($value, 'state') . '|' . array_var($value, 'country') . '|' . array_var($value, 'zip_code');
                         CustomPropertyValues::deleteCustomPropertyValues($object->getId(), $id);
                         $custom_property_value = new CustomPropertyValue();
                         $custom_property_value->setObjectId($object->getId());
                         $custom_property_value->setCustomPropertyId($id);
                         $custom_property_value->setValue($val);
                         $custom_property_value->save();
                     } else {
                         //Save multiple values
                         CustomPropertyValues::deleteCustomPropertyValues($object->getId(), $id);
                         foreach ($value as &$val) {
                             if (is_array($val)) {
                                 // CP type == table
                                 $str_val = '';
                                 foreach ($val as $col_val) {
                                     $col_val = str_replace("|", "\\|", $col_val);
                                     $str_val .= ($str_val == '' ? '' : '|') . $col_val;
                                 }
                                 $val = $str_val;
                             }
                             if ($val != '') {
                                 $custom_property_value = new CustomPropertyValue();
                                 $custom_property_value->setObjectId($object->getId());
                                 $custom_property_value->setCustomPropertyId($id);
                                 $custom_property_value->setValue($val);
                                 $custom_property_value->save();
                             }
                         }
                     }
                 } else {
                     if ($custom_property->getType() == 'boolean') {
                         $value = isset($value);
                     }
                     $cpv = CustomPropertyValues::getCustomPropertyValue($object->getId(), $id);
                     if ($cpv instanceof CustomPropertyValue) {
                         $custom_property_value = $cpv;
                     } else {
                         $custom_property_value = new CustomPropertyValue();
                         $custom_property_value->setObjectId($object->getId());
                         $custom_property_value->setCustomPropertyId($id);
                     }
                     $custom_property_value->setValue($value);
                     $custom_property_value->save();
                 }
                 //Add to searchable objects
                 if ($object->isSearchable() && ($custom_property->getType() == 'text' || $custom_property->getType() == 'list' || $custom_property->getType() == 'numeric')) {
                     $name = str_replace("'", "\\'", $custom_property->getName());
                     if (is_array($value)) {
                         $value = implode(', ', $value);
                     }
                     $value = str_replace("'", "\\'", $value);
                     $sql = "INSERT INTO " . TABLE_PREFIX . "searchable_objects (rel_object_id, column_name, content)\r\n\t\t\t\t\t\tVALUES ('" . $object->getId() . "', '" . $name . "', '" . $value . "')\r\n\t\t\t\t\t\tON DUPLICATE KEY UPDATE content='" . $value . "'";
                     DB::execute($sql);
                 }
             }
         }
     }
     //Save the key - value pair custom properties (object_properties table)
     $object->clearObjectProperties();
     $names = array_var($_POST, 'custom_prop_names');
     $values = array_var($_POST, 'custom_prop_values');
     if (!is_array($names)) {
         return;
     }
     for ($i = 0; $i < count($names); $i++) {
         $name = trim($names[$i]);
         $value = trim($values[$i]);
         if ($name != '' && $value != '') {
             $property = new ObjectProperty();
             $property->setObject($object);
             $property->setPropertyName($name);
             $property->setPropertyValue($value);
             $property->save();
             if ($object->isSearchable()) {
                 $object->addPropertyToSearchableObject($property);
             }
         }
     }
 }
Beispiel #15
0
 function purge_trash($days = null, $limit = null, $extra_conditions = "")
 {
     ini_set('memory_limit', '512M');
     Env::useHelper("permissions");
     if (is_null($days)) {
         $days = config_option("days_on_trash");
     }
     if (is_null($limit)) {
         $limit = 1000;
     }
     $count = 0;
     if ($days >= 0) {
         $object_ids = array();
         $date = DateTimeValueLib::now()->add("d", -$days);
         $mail_join = "";
         $mail_cond = "";
         if (Plugins::instance()->isActivePlugin('mail')) {
             $mail_join = "LEFT JOIN " . TABLE_PREFIX . "mail_contents mc ON mc.object_id=o.id";
             $mail_cond = "AND NOT COALESCE(mc.is_deleted, false)";
         }
         $perm_join = "";
         $perm_conditions = "";
         if (logged_user() instanceof Contact) {
             $logged_user_pgids = logged_user()->getPermissionGroupIds();
             $perm_join = "INNER JOIN " . TABLE_PREFIX . "object_members om on om.object_id=o.id \r\n\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "contact_member_permissions cmp ON cmp.member_id=om.member_id AND cmp.object_type_id=o.object_type_id";
             $perm_conditions = "AND cmp.can_delete=1 AND cmp.permission_group_id IN (" . implode(',', $logged_user_pgids) . ")";
         }
         $sql = "SELECT o.id as id, o.name as name, ot.name as ot_name, ot.table_name as table_name\r\n\t\t\t\t\tFROM " . TABLE_PREFIX . "objects o \r\n\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "object_types ot ON ot.id=o.object_type_id {$mail_join} {$perm_join}\r\n\t\t\t\t\tWHERE trashed_by_id > 0 AND trashed_on < '" . $date->toMySQL() . "' {$mail_cond} {$extra_conditions} {$perm_conditions}\r\n\t\t\t\t\tLIMIT {$limit}";
         $rows = DB::executeAll($sql);
         foreach ($rows as $row) {
             try {
                 DB::beginWork();
                 $id = $row['id'];
                 $ot_name = $row['ot_name'];
                 $name = $row['name'];
                 $table_name = $row['table_name'];
                 $object_ids[] = $id;
                 // delete object information
                 $tables_to_delete = self::get_tables_to_clean($ot_name);
                 if ($ot_name != 'mail' && $ot_name != 'invoice') {
                     $tables_to_delete[] = array('table' => TABLE_PREFIX . $table_name, 'column' => 'object_id');
                 }
                 foreach ($tables_to_delete as $table_info) {
                     $table = $table_info['table'];
                     $column = $table_info['column'];
                     $sql = "DELETE FROM `{$table}` WHERE `{$column}` = '{$id}'";
                     DB::execute($sql);
                 }
                 // save log
                 $log = new ApplicationLog();
                 if (logged_user() instanceof Contact) {
                     $log->setTakenById(logged_user()->getId());
                 }
                 $log->setRelObjectId($id);
                 $log->setObjectName($name);
                 $log->setAction(ApplicationLogs::ACTION_DELETE);
                 $log->setIsSilent(true);
                 $log->save();
                 DB::commit();
                 $count++;
             } catch (DBQueryError $e) {
                 DB::rollback();
                 Logger::log("Error delting object in purge_trash: " . $e->getMessage() . "\n" . $e->getSQL() . "\n", Logger::ERROR);
             }
         }
         $ignored = null;
         Hook::fire('after_object_delete_permanently', $object_ids, $ignored);
     }
     return $count;
 }