示例#1
0
 private static function checkLinkDown(Module_Links $module, GWF_Links $link)
 {
     # Get HREF
     $href = $link->getVar('link_href');
     if (strpos($href, '/') === 0) {
         $href = 'http://' . GWF_DOMAIN . GWF_WEB_ROOT . substr($href, 1);
     }
     if (GWF_HTTP::pageExists($href)) {
         self::notice("Checking {$href} ... UP");
         $link->saveVar('link_downcount', 0);
         $link->saveOption(GWF_Links::DOWN | GWF_Links::DEAD, false);
     } else {
         self::notice("Checking {$href} ... DOWN");
         $link->increase('link_downcount', 1);
         $bits = GWF_Links::DOWN;
         $count = $link->getVar('link_downcount');
         if ($count > GWF_Links::DOWNCOUNT_DEAD) {
             $bits |= GWF_Links::DEAD;
         }
         $link->saveOption($bits, true);
     }
     $link->saveVar('link_lastcheck', time());
 }