Public Member Functions

ilCronWebResourceCheck Class Reference

Public Member Functions

 ilCronWebResourceCheck ()
 check ()
 __getCheckPeriod ()

Detailed Description

Definition at line 34 of file class.ilCronWebResourceCheck.php.


Member Function Documentation

ilCronWebResourceCheck::__getCheckPeriod (  ) 

Definition at line 90 of file class.ilCronWebResourceCheck.php.

References $ilias.

Referenced by check().

        {
                global $ilias;

                switch($ilias->getSetting('cron_web_resource_check'))
                {
                        case 1:
                                $period = 24 * 60 * 60;
                                break;

                        case 2:
                                $period = 7 * 24 * 60 * 60;
                                break;

                        case 3:
                                $period = 30 * 7 * 24 * 60 * 60;
                                break;

                        case 4:
                                $period = 4  * 30 * 7 * 24 * 60 * 60;
                                break;

                        default:
                                $period = 0;
                }
                return $period;
        }

Here is the caller graph for this function:

ilCronWebResourceCheck::check (  ) 

Definition at line 44 of file class.ilCronWebResourceCheck.php.

References __getCheckPeriod(), ilUtil::_getObjectsByOperations(), and ilObjectFactory::getInstanceByRefId().

        {
                global $ilObjDataCache,$ilUser;

                include_once'./classes/class.ilLinkChecker.php';


                foreach(ilUtil::_getObjectsByOperations('webr','write',$ilUser->getId(),-1) as $node)
                {
                        if(!is_object($tmp_webr =& ilObjectFactory::getInstanceByRefId($node,false)))
                        {
                                continue;
                        }

                        $tmp_webr->initLinkResourceItemsObject();
                        
                        // Set all link to valid. After check invalid links will be set to invalid

                        $link_checker =& new ilLinkChecker($this->db);
                        $link_checker->setMailStatus(true);
                        $link_checker->setCheckPeriod($this->__getCheckPeriod());
                        $link_checker->setObjId($tmp_webr->getId());


                        $tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod());
                        foreach($link_checker->checkWebResourceLinks() as $invalid)
                        {
                                $tmp_webr->items_obj->readItem($invalid['page_id']);
                                $tmp_webr->items_obj->setActiveStatus(false);
                                $tmp_webr->items_obj->setValidStatus(false);
                                $tmp_webr->items_obj->setDisableCheckStatus(true);
                                $tmp_webr->items_obj->setLastCheckDate(time());
                                $tmp_webr->items_obj->update(false);
                        }
                        
                        $tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod());

                        foreach($link_checker->getLogMessages() as $message)
                        {
                                $this->log->write($message);
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilCronWebResourceCheck::ilCronWebResourceCheck (  ) 

Definition at line 36 of file class.ilCronWebResourceCheck.php.

References $ilLog.

        {
                global $ilLog,$ilDB;

                $this->log =& $ilLog;
                $this->db =& $ilDB;
        }


The documentation for this class was generated from the following file: