Example #1
0
 /**
  * @param string|\Exception $msg
  * @param array $context
  * @throws \RuntimeException
  */
 public static function warn($msg, array $context = array())
 {
     if (empty(static::$instance)) {
         throw new \RuntimeException('Logger instance not added to proxy yet');
     }
     static::$instance->warn($msg, $context);
 }
Example #2
0
 public function setPageName($pageName)
 {
     if (strlen($pageName) > 64) {
         $this->log->warn('The following pagename exceeds 64 characters: ' . $pageName);
     }
     $this->pageName = $pageName;
 }
 /**
  * Extract Field data from XML input
  *
  * @param Tracker_FormElement_Field $field
  * @param SimpleXMLElement $field_change
  *
  * @return mixed
  */
 public function getFieldData(Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     $values = $field_change->value;
     $files_infos = array();
     if ($this->isFieldChangeEmpty($values)) {
         $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': field value is empty.');
         return $files_infos;
     }
     foreach ($values as $value) {
         try {
             $attributes = $value->attributes();
             $file_id = (string) $attributes['ref'];
             $file = $this->files_importer->getFileXML($file_id);
             if (!$this->files_importer->fileIsAlreadyImported($file_id)) {
                 $files_infos[] = $this->getFileInfoForAttachment($file);
                 $this->files_importer->markAsImported($file_id);
             }
         } catch (Tracker_Artifact_XMLImport_Exception_FileNotFoundException $exception) {
             $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': ' . $exception->getMessage());
         }
     }
     if ($this->itCannotImportAnyFiles($values, $files_infos)) {
         throw new Tracker_Artifact_XMLImport_Exception_NoValidAttachementsException();
     }
     return $files_infos;
 }
Example #4
0
 /**
  * Sends a notice about deprecated use of a function, view, etc.
  *
  * @param string $msg             Message to log
  * @param string $dep_version     Human-readable *release* version: 1.7, 1.8, ...
  * @param int    $backtrace_level How many levels back to display the backtrace.
  *                                Useful if calling from functions that are called
  *                                from other places (like elgg_view()). Set to -1
  *                                for a full backtrace.
  * @return bool
  */
 function sendNotice($msg, $dep_version, $backtrace_level = 1)
 {
     if (!$dep_version) {
         return false;
     }
     $elgg_version = elgg_get_version(true);
     $elgg_version_arr = explode('.', $elgg_version);
     $elgg_major_version = (int) $elgg_version_arr[0];
     $elgg_minor_version = (int) $elgg_version_arr[1];
     $dep_version_arr = explode('.', (string) $dep_version);
     $dep_major_version = (int) $dep_version_arr[0];
     $dep_minor_version = (int) $dep_version_arr[1];
     $msg = "Deprecated in {$dep_major_version}.{$dep_minor_version}: {$msg} Called from ";
     // Get a file and line number for the log. Skip over the function that
     // sent this notice and see who called the deprecated function itself.
     $stack = array();
     $backtrace = debug_backtrace();
     // never show this call.
     array_shift($backtrace);
     $i = count($backtrace);
     foreach ($backtrace as $trace) {
         $stack[] = "[#{$i}] {$trace['file']}:{$trace['line']}";
         $i--;
         if ($backtrace_level > 0) {
             if ($backtrace_level <= 1) {
                 break;
             }
             $backtrace_level--;
         }
     }
     $msg .= implode("<br /> -> ", $stack);
     $this->logger->warn($msg);
     return true;
 }
Example #5
0
 /**
  * Sends a notice about deprecated use of a function, view, etc.
  *
  * @param string $msg             Message to log
  * @param string $dep_version     Human-readable *release* version: 1.7, 1.8, ...
  * @param int    $backtrace_level How many levels back to display the backtrace.
  *                                Useful if calling from functions that are called
  *                                from other places (like elgg_view()). Set to -1
  *                                for a full backtrace.
  * @return bool
  */
 function sendNotice($msg, $dep_version, $backtrace_level = 1)
 {
     $msg = "Deprecated in {$dep_version}: {$msg} Called from ";
     // Get a file and line number for the log. Skip over the function that
     // sent this notice and see who called the deprecated function itself.
     $stack = array();
     $backtrace = debug_backtrace();
     // never show this call.
     array_shift($backtrace);
     $i = count($backtrace);
     foreach ($backtrace as $trace) {
         if (empty($trace['file'])) {
             // file/line not set for Closures
             $stack[] = "[#{$i}] unknown";
         } else {
             $stack[] = "[#{$i}] {$trace['file']}:{$trace['line']}";
         }
         $i--;
         if ($backtrace_level > 0) {
             if ($backtrace_level <= 1) {
                 break;
             }
             $backtrace_level--;
         }
     }
     $msg .= implode("<br /> -> ", $stack);
     $this->logger->warn($msg);
     return true;
 }
 public function updateWithUserId($user_id)
 {
     $user = $this->user_manager->getUserById($user_id);
     if ($user && $user->isAlive()) {
         $this->updateWithUser($user);
     } else {
         $this->logger->warn('Do not write LDAP info about non existant or suspended users ' . $user_id);
     }
 }
 private function importLanguage(Project $project, $language)
 {
     $this->logger->info("Set language to {$language} for {$project->getUnixName()}");
     try {
         $this->language_manager->saveLanguageOption($project, $language);
     } catch (Mediawiki_UnsupportedLanguageException $e) {
         $this->logger->warn("Could not set up the language for {$project->getUnixName()} mediawiki, {$language} is not sopported.");
     }
 }
 public function cleanUpGitoliteAdminWorkingCopy()
 {
     if ($this->dao->isGitGcEnabled()) {
         $this->logger->info('Running git gc on gitolite admin working copy.');
         $this->execGitGcAsAppAdm();
     } else {
         $this->logger->warn('Cannot run git gc on gitolite admin working copy. ' . 'Please run as root: /usr/share/codendi/src/utils/php-launcher.sh ' . '/usr/share/codendi/plugins/git/bin/gl-admin-housekeeping.php');
     }
 }
Example #9
0
 public static function push($msg, $code = self::GENERIC_ERROR, $severity = self::SEVERITY_ERROR)
 {
     self::init();
     self::$errors->enqueue(new Error($msg, $code, $severity));
     if ($severity == self::SEVERITY_ERROR) {
         self::$logger->error($msg);
     } else {
         self::$logger->warn($msg);
     }
 }
 private function appendValidValue(array &$data, Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     try {
         $submitted_value = $this->getFieldData($field, $field_change);
         if ($field->validateField($this->createFakeArtifact(), $submitted_value)) {
             $data[$field->getId()] = $submitted_value;
         } else {
             $this->logger->warn("Skipped invalid value " . (string) $submitted_value . " for field " . $field->getName());
         }
     } catch (Tracker_Artifact_XMLImport_Exception_NoValidAttachementsException $exception) {
         $this->logger->warn("Skipped invalid value for field " . $field->getName() . ': ' . $exception->getMessage());
     } catch (Tracker_Artifact_XMLImport_Exception_ArtifactLinksAreIgnoredException $exception) {
         return;
     }
 }
Example #11
0
 /**
  * @static
  * @return Zend_Db_Adapter_Abstract
  */
 public static function getConnection()
 {
     $charset = "UTF8";
     // explicit set charset for connection (to the adapter)
     $config = Pimcore_Config::getSystemConfig()->toArray();
     $config["database"]["params"]["charset"] = $charset;
     $db = Zend_Db::factory($config["database"]["adapter"], $config["database"]["params"]);
     $db->query("SET NAMES " . $charset);
     // try to set innodb as default storage-engine
     try {
         $db->query("SET storage_engine=InnoDB;");
     } catch (Exception $e) {
         Logger::warn($e);
     }
     // enable the db-profiler if the devmode is on and there is no custom profiler set (eg. in system.xml)
     if (PIMCORE_DEVMODE && !$db->getProfiler()->getEnabled()) {
         $profiler = new Pimcore_Db_Profiler('All DB Queries');
         $profiler->setEnabled(true);
         $db->setProfiler($profiler);
     }
     // put the connection into a wrapper to handle connection timeouts, ...
     $db = new Pimcore_Resource_Wrapper($db);
     Logger::debug("Successfully established connection to MySQL-Server");
     return $db;
 }
Example #12
0
 /**
  * @param string $remoteQuery Gerrity query
  * @param boolean $expectResponse If a JSON response is expected
  * @return null|ApiResult
  * @throws GerritException
  */
 private function send($remoteQuery, $expectResponse = true)
 {
     try {
         $this->logger->debug("Sending remote command to gerrit: {$remoteQuery}");
         $gerritResponseArray = $this->ssh->exec($remoteQuery);
         if (!$expectResponse) {
             return;
         }
         $stats = JSON::decode(array_pop($gerritResponseArray));
         if ($stats['type'] == 'error') {
             throw new GerritException($stats['message']);
         }
         $records = array();
         foreach ($gerritResponseArray as $json) {
             $records[] = JSON::decode($json);
         }
         return new ApiResult($stats, $records);
     } catch (CommandException $e) {
         $this->logger->warn('Gerrit query failed', $e);
         throw new GerritException('Query to gerrit failed', 0, $e);
     } catch (JSONParseException $e) {
         $this->logger->warn('Gerrit query returned bad json', $e);
         throw new GerritException('Gerrit query returned bad json', 0, $e);
     }
 }
Example #13
0
 /**
  * @param $cmd
  * @param null $outputFile
  * @param null $timeout
  * @return string
  */
 public static function exec($cmd, $outputFile = null, $timeout = null)
 {
     if ($timeout && self::getTimeoutBinary()) {
         // check if --kill-after flag is supported in timeout
         $killafter = "";
         $out = self::exec(self::getTimeoutBinary() . " --help");
         if (strpos($out, "--kill-after")) {
             $killafter = " -k 1m";
         }
         $cmd = self::getTimeoutBinary() . $killafter . " " . $timeout . "s " . $cmd;
     } elseif ($timeout) {
         \Logger::warn("timeout binary not found, executing command without timeout");
     }
     if ($outputFile) {
         $cmd = $cmd . " > " . $outputFile . " 2>&1";
     } else {
         // send stderr to /dev/null otherwise this goes to the apache error log and can fill it up pretty quickly
         if (self::getSystemEnvironment() != 'windows') {
             $cmd .= " 2> /dev/null";
         }
     }
     \Logger::debug("Executing command `" . $cmd . "` on the current shell");
     $return = shell_exec($cmd);
     return $return;
 }
 /**
  * Framework entry point
  *
  * @return void.
  */
 public function dispatch()
 {
     $request = new HTTPRequest();
     $response = new HTTPResponse();
     try {
         $configurator = $this->manager->getConfigurator();
         Registry::put($configurator, '__configurator');
         Registry::put($logger = new Logger($configurator), '__logger');
         $ap = $configurator->getApplicationPath();
         // application path
         $an = $configurator->getApplicationName();
         // application name
         $logger->debug('[Medick] >> version: ' . Medick::getVersion() . ' ready for ' . $an);
         $logger->debug('[Medick] >> Application path ' . $ap);
         $routes_path = $ap . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . $an . '.routes.php';
         include_once $routes_path;
         // load routes
         $logger->debug('[Medick] >> Config File: ' . str_replace($ap, '${' . $an . '}', $configurator->getConfigFile()));
         $logger->debug('[Medick] >> Routes loaded from: ' . str_replace($ap, '${' . $an . '}', $routes_path));
         ActionControllerRouting::recognize($request)->process($request, $response)->dump();
     } catch (Exception $ex) {
         ActionController::process_with_exception($request, $response, $ex)->dump();
         $logger->warn($ex->getMessage());
     }
 }
 public static function Nuevo($request)
 {
     try {
         self::ProblemaValido($request);
     } catch (InvalidArgumentException $e) {
         Logger::warn("imposible crear nuevo problema:" . $e->getMessage());
         return array("result" => "error", "reason" => $e->getMessage());
     }
     $usuarioActual = c_sesion::usuarioActual();
     if (!SUCCESS($usuarioActual)) {
         Logger::error("no hay permiso para crear nuevo problema");
         return array("result" => "error", "reason" => "No tienes permiso de hacer esto.");
     }
     $sql = "insert into Problema (titulo, problema, tiempoLimite, usuario_redactor) values (?,?,?,?)";
     $inputarray = array($request["titulo"], $request["problema"], $request["tiempoLimite"], $usuarioActual["userID"]);
     global $db;
     $res = $db->Execute($sql, $inputarray);
     if ($res === false) {
         Logger::error("TEDDY:" . $db->ErrorNo() . " " . $db->ErrorMsg());
         return array("result" => "error", "reason" => "Error interno.");
     }
     $id = $db->Insert_ID();
     if (!file_exists(PATH_TO_CASOS)) {
         Logger::error("TEDDY: " . PATH_TO_CASOS . " no existe");
         return array("result" => "error", "reason" => "Error interno.");
     }
     file_put_contents(PATH_TO_CASOS . "/" . $id . ".in", $request["entrada"]);
     file_put_contents(PATH_TO_CASOS . "/" . $id . ".out", $request["salida"]);
     Logger::info("Nuevo problema creado. ProbID: " . $id . " Titulo: " . $request["titulo"]);
     return array("result" => "ok", "probID" => $id);
 }
Example #16
0
 /**
  * Convert encoding
  *
  * @param $value
  * @param $to
  * @param $from
  *
  * @return string
  */
 public static function convert($value, $to, $from)
 {
     if ($value == null) {
         return $value;
     }
     //有ccode库
     $isccode = function_exists('is_gbk');
     //专门有处理gbk/utf8转码的扩展,解决一些badcase
     if ($to === 'GBK' && ($from === 'UTF-8' || $from === 'UTF8') && $isccode) {
         $v = utf8_to_gbk($value, strlen($value), UCONV_INVCHAR_REPLACE);
         if ($v !== false) {
             return $v;
         } else {
             Logger::warn("utf8_to_gbk fail str=%s", bin2hex($value));
         }
     }
     if (($to === 'UTF-8' || $to === 'UTF8') && $from === 'GBK' && $isccode) {
         $v = gbk_to_utf8($value, strlen($value), UCONV_INVCHAR_REPLACE);
         if ($v !== false) {
             return $v;
         } else {
             Logger::warn("gbk_to_utf8 fail str=%s", bin2hex($value));
         }
     }
     //return mb_convert_encoding($value,$to,$from);
     //mb_convert会由于字符编码问题出fatal,改成iconv //ignore模式
     return iconv($from, $to . '//ignore', $value);
 }
Example #17
0
 public function checkPermission($object, IPermission $perm, LoginContext $context = null)
 {
     try {
         if ($object === null) {
             throw new EyeNullPointerException('$object cannot be null.');
         }
         if ($perm === null) {
             throw new EyeNullPointerException('$perm cannot be null.');
         }
         if ($context === null) {
             $currentProcess = ProcManager::getInstance()->getCurrentProcess();
             if ($currentProcess === null) {
                 self::$Logger->warn('Cannot check permission on object of class ' . get_class($object) . ': No current process.');
                 throw new EyeAccessControlException('Access denied: No current process.');
             }
             $context = $currentProcess->getLoginContext();
             if ($context === null) {
                 //self::$Logger->warn('Cannot check permission on object of class ' . get_class($object) . ': No LoginContext found in current process.');
                 //throw new EyeAccessControlException('Access denied: No LoginContext found in current process.');
                 self::$Logger->info('Initializing blank login context for permission check on object of class ' . get_class($object) . '.');
                 $context = new LoginContext('eyeos-login', new Subject());
             }
         }
         $checker = new SecurityChecker();
         $checker->doCheck($object, $perm, $context);
     } catch (Exception $e) {
         self::$Logger->error('Cannot perform permission check: ' . $e->getMessage());
         if (self::$Logger->isDebugEnabled()) {
             self::$Logger->debug(ExceptionStackUtil::getStackTrace($e, false));
         }
         throw $e;
     }
 }
Example #18
0
 /**
  * 从$list索引数组中,取出每行的一个字段作为键,然后返回关联数组
  * 如果行中不存在这个键,那么会报warning,同时这行会被过滤;如果键重复,会覆盖之前的行
  *
  * @param   int|string  $key        存在$fullList中的键
  * @param   array       $fullList   完整的二维索引数组
  * @return  array       返回一个新的关联数组
  * @throws  LibraryException
  */
 public static function listToHash($key, array $fullList)
 {
     // 如果为空,返回
     if (empty($fullList)) {
         return array();
     }
     $retList = array();
     $warn = false;
     foreach ($fullList as $row) {
         // 键不存在
         if (!is_array($row)) {
             throw new LibraryException('$fullList必须是二维数组!');
         }
         if (!array_key_exists($key, $row)) {
             $warn = true;
             continue;
         }
         $retList[$row[$key]] = $row;
     }
     // 只警告一次
     if ($warn) {
         Logger::warn('library', "数组中不存在键:{$key}");
         trigger_error("数组中不存在键:{$key}", E_USER_WARNING);
     }
     return $retList;
 }
Example #19
0
 public function updateCollaboratorPermission(IShareable $object, AbstractEyeosPrincipal $collaborator, IPermission $permission)
 {
     try {
         if ($object->getId() === null) {
             throw new EyeNullPointerException('$object ID cannot be null.');
         }
         $handlerClassName = null;
         foreach (self::getAllShareableObjectsHandlers() as $handler) {
             if ($handler->checkType($object)) {
                 $handlerClassName = get_class($handler);
                 break;
             }
         }
         if ($handlerClassName === null) {
             throw new EyeHandlerNotFoundException('Unable to find a ShareableObjectHandler for object of class ' . get_class($object) . '.');
         }
         $owner = $object->getShareOwner();
         SecurityManager::getInstance()->checkPermission($object, new SharePermission(array('updatecollaborator'), $collaborator));
         //prepare query array
         $shareInfoQuery = array(self::SHAREINFO_KEY_OWNERID => $owner->getId(), self::SHAREINFO_KEY_SHAREABLEID => $object->getId(), self::SHAREINFO_KEY_COLLABORATORID => $collaborator->getId(), self::SHAREINFO_KEY_PERMISSIONACTIONS => $permission->getActionsAsString(), self::SHAREINFO_KEY_HANDLERCLASSNAME => $handlerClassName);
         $this->getProvider()->updateShareInfo($owner, $shareInfoQuery);
         // TODO: we could also add the ShareInfo object containing the old permission as a
         // "related source" of the event
         $event = new SharingEvent(new BasicShareInfo($owner, $object, $collaborator, $permission, $handlerClassName));
         foreach ($this->listeners as $listener) {
             $listener->collaboratorPermissionUpdated($event);
         }
     } catch (Exception $e) {
         self::$Logger->warn('Unable to update collaborator ' . $collaborator->getName() . ' permissions for object of class ' . get_class($object) . '.');
         if (self::$Logger->isDebugEnabled()) {
             self::$Logger->debug(ExceptionStackUtil::getStackTrace($e, false));
         }
         throw $e;
     }
 }
Example #20
0
 /**
  * Search in the LDAP directory
  * 
  * @see http://php.net/ldap_search
  * 
  * @param String  $baseDn     Base DN where to search
  * @param String  $filter     Specific LDAP query
  * @param Integer $scope      How to search (SCOPE_ SUBTREE, ONELEVEL or BASE)
  * @param Array   $attributes LDAP fields to retreive
  * @param Integer $attrsOnly  Retreive both field value and name (keep it to 0)
  * @param Integer $sizeLimit  Limit the size of the result set
  * @param Integer $timeLimit  Limit the time spend to search for results
  * @param Integer $deref      Dereference result
  * 
  * @return LDAPResultIterator
  */
 function search($baseDn, $filter, $scope = self::SCOPE_SUBTREE, $attributes = array(), $attrsOnly = 0, $sizeLimit = 0, $timeLimit = 0, $deref = LDAP_DEREF_NEVER)
 {
     if ($this->_connectAndBind()) {
         $this->_initErrorHandler();
         switch ($scope) {
             case self::SCOPE_BASE:
                 $sr = ldap_read($this->ds, $baseDn, $filter, $attributes, $attrsOnly, $sizeLimit, $timeLimit, $deref);
                 break;
             case self::SCOPE_ONELEVEL:
                 $sr = ldap_list($this->ds, $baseDn, $filter, $attributes, $attrsOnly, $sizeLimit, $timeLimit, $deref);
                 break;
             case self::SCOPE_SUBTREE:
             default:
                 $sr = ldap_search($this->ds, $baseDn, $filter, $attributes, $attrsOnly, $sizeLimit, $timeLimit, $deref);
         }
         $this->_restoreErrorHandler();
         if ($sr !== false) {
             $this->logger->debug('LDAP search success ' . $baseDn . ' ' . $filter . ' *** SCOPE: ' . $scope . ' *** ATTRIBUTES: ' . implode(', ', $attributes));
             $entries = ldap_get_entries($this->ds, $sr);
             if ($entries !== false) {
                 return new LDAPResultIterator($entries, $this->ldapParams);
             }
         } else {
             $this->logger->warn('LDAP search error: ' . $baseDn . ' ' . $filter . ' ' . $this->ldapParams['server'] . ' ***ERROR:' . ldap_error($this->ds) . ' ***ERROR no:' . $this->getErrno());
         }
     }
     return false;
 }
Example #21
0
 /**
  * フレームワークを起動させる
  *
  * @access  public
  * @since   3.0.0
  */
 public function execute()
 {
     $this->log->debug("************** controller#execute called.");
     // デフォルトトランザクションをコンテナに登録
     $defaultTx = $this->txManager->getTransaction();
     $this->container->register('DefaultTx', $defaultTx);
     // 実行するActionを決定
     $actionName = $this->hook->makeActionName();
     if ($actionName == NULL) {
         throw new Teeple_Exception("アクションが特定できません。");
     }
     // 初期ActionをActionChainにセット
     $this->log->debug("****actionName: {$actionName}");
     try {
         $this->actionChain->add($actionName);
     } catch (Exception $e) {
         $this->log->warn($e->getMessage());
         $isContinue = $this->hook->actionClassNotFound($actionName);
         if (!$isContinue) {
             return;
         }
     }
     // FilterChainのセットアップと実行
     $this->filterChain->build();
     $this->filterChain->execute();
     //$this->filterChain->clear();
 }
Example #22
0
File: Dao.php Project: sfie/pimcore
 /**
  *
  */
 public function save()
 {
     try {
         $this->db->insert("users_permission_definitions", array("key" => $this->model->getKey()));
     } catch (\Exception $e) {
         \Logger::warn($e);
     }
 }
Example #23
0
 public function myValidate()
 {
     if (strpos($this->label, '/') !== false || strpos($this->label, '%')) {
         Logger::warn('bnode labels should not contain / or : or %, but i will patch it for now (converting to _)');
         //shouldnot start with number
         $this->label = str_replace('/', '_', str_replace('%', '_', str_replace(':', '_', $this->label)));
     }
     return true;
 }
Example #24
0
 /**
  * Gets object mockup by id, can consider subIds and therefore return e.g. an array of values
  * always returns a object mockup if available
  *
  * @param $objectId
  * @return OnlineShop_Framework_ProductInterfaces_IIndexable | array
  */
 public function getObjectMockupById($objectId)
 {
     $mockup = $this->getTenantWorker()->getMockupFromCache($objectId);
     if (empty($mockup)) {
         Logger::warn("Could not load element with ID {$objectId} as mockup, loading complete object");
         return $this->getObjectById($objectId);
     } else {
         return $mockup;
     }
 }
 public function ldapSync($row, $users_are_suspendable = true)
 {
     $ldap_query = $this->ldap->getLDAPParam('eduid') . '=' . $row['ldap_id'];
     $userSync = $this->getLdapUserSync();
     $attributes = $userSync->getSyncAttributes($this->ldap);
     $time_start = microtime(true);
     $lri = false;
     $search_depth = LDAP::SCOPE_SUBTREE;
     if ($this->ldap->getLDAPParam('search_depth') === LDAP::SCOPE_ONELEVEL_TEXT) {
         $search_depth = LDAP::SCOPE_ONELEVEL;
     }
     foreach (split(';', $this->ldap->getLDAPParam('people_dn')) as $PeopleDn) {
         $lri = $this->ldap->search($PeopleDn, $ldap_query, $search_depth, $attributes);
         if (count($lri) == 1 && $lri != false) {
             break;
         }
     }
     $time_end = microtime(true);
     $this->ldapTime += $time_end - $time_start;
     if ($this->ldap->getErrno() === LDAP::ERR_SUCCESS && $lri) {
         $user = new PFUser($row);
         $modified = false;
         if (count($lri) == 1) {
             $lr = $lri->current();
             $modified = $userSync->sync($user, $lr);
             if ($row['ldap_uid'] != $lr->getLogin()) {
                 $this->getLdapUserManager()->updateLdapUid($user, $lr->getLogin());
             }
         } elseif (count($lri) == 0 && $users_are_suspendable) {
             $this->logger->warn('LDAP user to be suspended: ' . $user->getId() . ' ' . $user->getUserName());
             $this->logger->debug(' *** PEOPLEDN: ' . $PeopleDn . ' *** LDAP QUERY: ' . $ldap_query . ' *** ATTRIBUTES: ' . print_r($attributes, true));
             // User not found in LDAP directory
             $modified = true;
             $user->setStatus('S');
             $user->setUnixStatus('D');
         }
         if ($modified) {
             $em = $this->getEventManager();
             $em->processEvent(LDAP_DAILY_SYNCHRO_UPDATE_USER, $user);
             if ($user->getStatus() == 'S' && $users_are_suspendable) {
                 $this->getUserManager()->updateDb($user);
                 if ($retentionPeriod = $this->ldap->getLDAPParam('daily_sync_retention_period')) {
                     $projectManager = $this->getProjectManager();
                     $this->getLdapSyncNotificationManager($projectManager, $retentionPeriod)->processNotification($user);
                     $this->getCleanUpManager()->addUserDeletionForecastDate($user);
                 }
             } else {
                 if ($user->getStatus() != 'S') {
                     $this->getUserManager()->updateDb($user);
                 }
             }
         }
     }
     $this->remindAdminsBeforeCleanUp();
 }
Example #26
0
 public static function printTime($precision = 2)
 {
     $message = self::getTimeAsString($precision);
     if (count(self::$start) > 0) {
         Logger::warn("Timer: Unfinished timers:");
         foreach (array_keys(self::$start) as $key) {
             Logger::warn("Timer: " . $key);
         }
     }
     Logger::info($message);
 }
Example #27
0
 /**
  * Dispatches an event to all the listeners on the current file object.
  * 
  * @param string $type
  * @param 
  */
 public function fireEvent($type, FileEvent $event)
 {
     foreach ($this->getAllFileListeners() as $listener) {
         if (is_callable(array($listener, $type))) {
             try {
                 $listener->{$type}($event);
             } catch (Exception $e) {
                 self::$Logger->warn('Exception while trying to fire ' . $type . ' event on listener ' . get_class($listener) . ': ' . $e->getMessage());
             }
         }
     }
 }
Example #28
0
 public static function serializeToFile($array, $filename, $statisticdir)
 {
     @mkdir($statisticdir);
     if (is_writable($statisticdir)) {
         $fp = fopen($statisticdir . '/' . $filename, 'w');
         $ser = serialize($array);
         fwrite($fp, $ser);
         fclose($fp);
     } else {
         Logger::warn('Statistics.php:  dir not writable: ' . $statisticdir . '/' . $filename);
     }
 }
Example #29
0
 public static function transRollback()
 {
     if (!self::$isTrans) {
         Logger::error("Transaccion rollback pero no hay transaccion activa !!.");
         return;
     }
     self::$transCount = 0;
     global $conn;
     $conn->FailTrans();
     Logger::warn("Transaccion rollback !");
     self::$isTrans = false;
 }
Example #30
0
 public function validate()
 {
     try {
         $this->subject->myValidate();
         $this->predicate->myValidate();
         $this->object->myValidate();
     } catch (Exception $e) {
         Logger::warn($e->getMessage());
         return false;
     }
     return true;
 }