Example #1
0
 /**
  * Gather all the checksums (aka. file hashes) of this site, send them, and
  * analyze them using the Sucuri Monitoring service, this will generate the
  * audit logs for this site and be part of the integrity checks.
  *
  * @param  boolean $force_scan Whether the filesystem scan was forced by an administrator user or not.
  * @return boolean             TRUE if the filesystem scan was successful, FALSE otherwise.
  */
 public static function filesystem_scan($force_scan = false)
 {
     $minimum_runtime = SUCURISCAN_MINIMUM_RUNTIME;
     if (self::verify_run($minimum_runtime, $force_scan) && class_exists('SucuriScanFileInfo') && SucuriScanAPI::getPluginKey()) {
         self::report_site_version();
         $file_info = new SucuriScanFileInfo();
         $file_info->scan_interface = SucuriScanOption::get_option(':scan_interface');
         $signatures = $file_info->get_directory_tree_md5(ABSPATH);
         if ($signatures) {
             $hashes_sent = SucuriScanAPI::sendHashes($signatures);
             if ($hashes_sent) {
                 SucuriScanOption::update_option(':runtime', time());
                 return true;
             } else {
                 SucuriScanInterface::error('The file hashes could not be stored.');
             }
         } else {
             SucuriScanInterface::error('The file hashes could not be retrieved, the filesystem scan failed.');
         }
     }
     return false;
 }