Nabble\SemaltBlocker\Updater::update PHP Method

update() public static method

Try to update the blocked domains list.
public static update ( boolean $force = false )
$force boolean
    public static function update($force = false)
    {
        if (!defined('SEMALT_UNIT_TESTING') && !self::isWritable()) {
            return;
        }
        if (!$force && !self::isOutdated()) {
            return;
        }
        self::doUpdate();
    }

Usage Example

コード例 #1
0
 /**
  * @depends testDomainsRetrieval
  */
 public function testForcedDomainsUpdate()
 {
     $domainList = \Nabble\SemaltBlocker\Updater::getNewDomainList();
     file_put_contents($this->blockFile, '');
     \Nabble\SemaltBlocker\Updater::$ttl = 60 * 60 * 24 * 9999;
     // = 9999 days;
     \Nabble\SemaltBlocker\Updater::update(true);
     $this->assertStringEqualsFile($this->blockFile, $domainList, 'Blocked file should match online domain list');
 }
All Usage Examples Of Nabble\SemaltBlocker\Updater::update