当前位置: 首页>>代码示例>>PHP>>正文


PHP WPFB_Core::LogMsg方法代码示例

本文整理汇总了PHP中WPFB_Core::LogMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::LogMsg方法的具体用法?PHP WPFB_Core::LogMsg怎么用?PHP WPFB_Core::LogMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPFB_Core的用法示例。


在下文中一共展示了WPFB_Core::LogMsg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ScanFile

 /**
  * 1. Checks if file is actually present and readable on file system and either sets file offline or completly removes it
  * 2. If file hash not set, calculate it
  * 3. Try to generate a thumbnail if it does not exists
  * 4. Update ID3 info (with _async_ RPC if enabled)
  *
  * @param WPFB_File $file
  * @param bool      $forced_refresh_thumb
  *
  * @return bool
  */
 static function ScanFile($file, $forced_refresh_thumb = false, $allow_async = true)
 {
     $forced_refresh_thumb = $forced_refresh_thumb || $file->file_rescan_pending > 1;
     $file->file_rescan_pending = max($file->file_rescan_pending, $forced_refresh_thumb ? 2 : 1);
     if (!$file->TryScanLock()) {
         WPFB_Core::LogMsg("ERROR: ScanFile {$file} locking failed!", 'sync');
         return false;
     }
     $file_path = $file->GetLocalPath();
     if (!$file->IsLocal()) {
         $res = WPFB_Admin::SideloadFile($file, $file_path);
         if ($res['error']) {
             WPFB_Core::LogMsg("ERROR: ScanFile({$file}) download {$file->GetRemoteUri()} failed {$res['error']}!", 'sync');
             $file->file_rescan_pending = 0;
             $file->DbSave(true);
             return false;
         }
     } elseif (!is_file($file_path) || !is_readable($file_path)) {
         if (WPFB_Core::$settings->remove_missing_files) {
             WPFB_Core::LogMsg("ScanFile({$file}) removing missing file!", 'sync');
             $file->Remove();
             return true;
         } else {
             $file->file_offline = true;
             $file->file_mtime = 0;
             $file->DbSave(true);
             return true;
         }
     }
     if (empty($file->file_hash)) {
         $file->file_hash = WPFB_Admin::GetFileHash($file->GetLocalPath());
     }
     if (empty($file->file_thumbnail) || $forced_refresh_thumb || !is_file($file->GetThumbPath())) {
         $file->Lock(true);
         $file->CreateThumbnail();
         // this only deltes old thumb if success
         $file->Lock(false);
         if (WPFB_Core::$settings->base_auto_thumb && (empty($file->file_thumbnail) || !is_file($file->GetThumbPath()))) {
             $pwe = substr($file->GetLocalPath(), 0, strrpos($file->GetLocalPath(), '.') + 1);
             if ($pwe && (file_exists($thumb = $pwe . 'png') || file_exists($thumb = $pwe . 'thumb.png') || file_exists($thumb = $pwe . 'jpg') || file_exists($thumb = $pwe . 'thumb.jpg') || file_exists($thumb = $pwe . 'gif') || file_exists($thumb = $pwe . 'thumb.gif'))) {
                 $file->file_thumbnail = basename($thumb);
                 $dest_thumb = $file->GetThumbPath(true);
                 if ($dest_thumb != $thumb) {
                     $dir = dirname($dest_thumb);
                     if (!is_dir($dir)) {
                         WPFB_Admin::Mkdir($dir);
                     }
                     rename($thumb, $dest_thumb);
                 }
             }
         }
     }
     $file->DBSave(true);
     // the UpdateCachedFileInfo/StoreFileInfo will delete the file if necessary! (no need of $tmp_file value!)
     if (!WPFB_GetID3::UpdateCachedFileInfo($file)) {
         WPFB_Core::LogMsg("ScanFile({$file}) file scan failed!", 'sync');
         return false;
     }
     return true;
 }
开发者ID:noxian,项目名称:WP-Filebase,代码行数:71,代码来源:Sync.php


注:本文中的WPFB_Core::LogMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。