ご返信感謝申し上げます。
思い当たるものといたしましては、エラーが起こる前に、管理画面でアドオンの更新作業を行いました。
以前から更新・インストールのお知らせが出ていたのですが、いつも英文にてsuccessfully installedと表示されても、また更新できる旨の通知が出てきておりました。
何回かその更新作業を試みたのですが、その際は何もエラーは発生しませんでした。
サイトにアクセスできなくなったのは、今回が初めてです。
どうかよろしくお願い申し上げます。
Fatal error: Class 'FileHelper' not found in...について
2013年8月30日 at 10:30
いつも利用させて頂いております。
昨日、急にホームページが閲覧できなくなり、下記のメッセージが表示されるようになってしまいました。
Fatal error: Class 'FileHelper' not found in /home/サイト名/www/concrete5.6.1.2.ja/concrete/core/libraries/loader.php on line 305
原因・対策等について、ご教示願えませんでしょうか。
尚、その他の情報に関しては下記の通りです。
バージョン:concrete5.6.1.2
ブラウザ:Firefox23.0.1
サーバー:さくらインターネット、スタンダード
どうかよろしくお願いいたします。
タグ:
Re: Re: Fatal error: Class 'FileHelper' not found in...について
2013年8月30日 at 13:32
FileHelper クラスが見当たらないというエラーですのですが、通常はこの問題は起らないはずです。
調査方法(ややこしいので不明点があればまた書き込んでください。)
concrete/helpers/file.php があるかどうかチェック(ファイル内が問題ないかチェックする)
helpers/file.php ファイルがないかチェックする。(ある場合はこれが問題の可能性がありますので差し支えなければファイルの内部を教えてください。)
また、もちかすると更新したアドオンが影響している可能性もあります。差し支えなければアドオン名を教えていただけますか?
調査方法(ややこしいので不明点があればまた書き込んでください。)
concrete/helpers/file.php があるかどうかチェック(ファイル内が問題ないかチェックする)
helpers/file.php ファイルがないかチェックする。(ある場合はこれが問題の可能性がありますので差し支えなければファイルの内部を教えてください。)
また、もちかすると更新したアドオンが影響している可能性もあります。差し支えなければアドオン名を教えていただけますか?
Re: Fatal error: Class 'FileHelper' not found in...について
2013年8月30日 at 13:52
ありがとうございます。
concrete/helpers/file.phpはありました。
先程から内容を記載しようとしているのですが、うまくいきません。
本フォーラムへの記載方法をご教示頂けませんでしょうか。
申し訳ありません。
また、更新したアドオンについては、よく覚えていないのですが、下記のうちのいずれかだったかと存じます。
File With Description
Google Docs Viewer
List Files From Set
concrete/helpers/file.phpはありました。
先程から内容を記載しようとしているのですが、うまくいきません。
本フォーラムへの記載方法をご教示頂けませんでしょうか。
申し訳ありません。
また、更新したアドオンについては、よく覚えていないのですが、下記のうちのいずれかだったかと存じます。
File With Description
Google Docs Viewer
List Files From Set
Re: Fatal error: Class 'FileHelper' not found in...について
2013年8月30日 at 14:31
失礼いたしました。最初の「(」のみ変更したら、記載できました。
以下、concrete/helpers/file.phpの内容です。
(?php
/**
* File helper
*
* Functions useful for working with files and directories.
*
* Used as follows:
* <code>
* $file = Loader::helper('file');
* $path = 'http://www.concrete5.org/tools/get_latest_version_number';
* $contents = $file->getContents($path);
* echo $contents;
* </code>
*
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
defined('C5_EXECUTE') or die("Access Denied.");
class FileHelper extends Concrete5_Helper_File {}
以下、concrete/helpers/file.phpの内容です。
(?php
/**
* File helper
*
* Functions useful for working with files and directories.
*
* Used as follows:
* <code>
* $file = Loader::helper('file');
* $path = 'http://www.concrete5.org/tools/get_latest_version_number';
* $contents = $file->getContents($path);
* echo $contents;
* </code>
*
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
defined('C5_EXECUTE') or die("Access Denied.");
class FileHelper extends Concrete5_Helper_File {}
Re: Re: Re: Fatal error: Class 'FileHelper' not found in...について
2013年8月30日 at 14:40
helpers/file.phpは下記の通りです。
(?php
/**
* File helper
*
* Functions useful for working with files and directories.
*
* Used as follows:
* <code>
* $file = Loader::helper('file');
* $path = 'http://www.concrete5.org/tools/get_latest_version_number';
* $contents = $file->getContents($path);
* echo $contents;
* </code>
*
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
defined('C5_EXECUTE') or die("Access Denied.");
class FileHelper extends Concrete5_Helper_File {}
(?php
/**
* File helper
*
* Functions useful for working with files and directories.
*
* Used as follows:
* <code>
* $file = Loader::helper('file');
* $path = 'http://www.concrete5.org/tools/get_latest_version_number';
* $contents = $file->getContents($path);
* echo $contents;
* </code>
*
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
defined('C5_EXECUTE') or die("Access Denied.");
class FileHelper extends Concrete5_Helper_File {}
Re: Re: Re: Fatal error: Class 'FileHelper' not found in...について
2013年8月30日 at 16:03
度々申し訳ございません。
お伺いのhelpers/file.phpとは、concrete5.6.1.2.ja/helpers/file.phpのことでしたでしょうか。
上記のものですと、内容は下記のようになっておりました。
度々お伺いし、申し訳ありませんが、どうかよろしくお願い申し上げます。
(?php
/**
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
/**
* Functions useful for working with files and directories.
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
defined('C5_EXECUTE') or die("Access Denied.");
Loader::element('func_mb_filename');
class SiteFileHelper extends FileHelper {
/**
* @access private
*/
protected $ignoreFiles = array('__MACOSX', DIRNAME_CONTROLLERS);
/**
* Returns the contents of a directory in an array.
* @param string $directory
* @return array
*/
public function getDirectoryContents($dir, $ignoreFilesArray = array()) {
$this->ignoreFiles = array_merge($this->ignoreFiles, $ignoreFilesArray);
$aDir = array();
if (is_dir($dir)) {
$handle = opendir($dir);
while(($file = readdir($handle)) !== false) {
if (substr($file, 0, 1) != '.' && (!in_array($file, $this->ignoreFiles))) {
$aDir[] = $file;
}
}
}
return $aDir;
}
/**
* Removes the extension of a filename, uncamelcases it.
* @param string $filename
* @return string
*/
public function unfilename($filename) {
// removes the extension and makes it look nice
$txt = Loader::helper('text');
return substr($txt->unhandle($filename), 0, strrpos($filename, '.'));
}
/**
* Recursively copies all items in the source directory to the target directory
* @param string $source
* @param string $target
*/
public function copyAll($source, $target, $mode = 0777) {
if (is_dir($source)) {
@mkdir($target, $mode);
@chmod($target, $mode);
$d = dir($source);
while (FALSE !== ($entry = $d->read())) {
if ( $entry == '.' || $entry == '..' || substr($entry, 0, 1) == '.') {
continue;
}
$Entry = $source . '/' . $entry;
if (is_dir($Entry)) {
$this->copyAll($Entry, $target . '/' . $entry, $mode);
continue;
}
copy($Entry, $target . '/' . $entry);
chmod($target . '/' . $entry, $mode);
}
$d->close();
} else {
copy($source, $target);
chmod($target, $mode);
}
}
/**
* Takes a path to a file and sends it to the browser, streaming it, and closing the HTTP connection afterwards. Basically a force download method
*/
public function forceDownload($file, $download_filename = false) {
$handle = @fopen($file, 'rb');
if ($handle === false) {
// Not Found
header('HTTP/1.1 404 Not Found');
return false;
}
header('Content-type: application/octet-stream');
//$h = Loader::helper('mime');
//$mimeType = $h->mimeFromExtension($this->getExtension($file));
//header('Content-type: ' . $mimeType);
if($download_filename){
$filename = $download_filename;
}else{
$filename = basename($file);
}
$ua = $_SERVER['HTTP_USER_AGENT'];
if (strstr($ua, 'MSIE') && !strstr($ua, 'Opera')) {
$filename = mb_convert_encoding($filename, "SJIS", APP_CHARSET);
}
header("Content-Disposition: attachment; filename=\"$filename\"");
header('Content-Length: ' . filesize($file));
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Transfer-Encoding: binary");
$buffer = '';
$chunk = 1024*1024;
while (!feof($handle)) {
$buffer = fread($handle, $chunk);
print $buffer;
}
fclose($handle);
exit;
}
/**
* Returns the full path to the temporary directory
*/
public function getTemporaryDirectory() {
if (!is_dir(DIR_TMP)) {
mkdir(DIR_TMP, 0777);
touch(DIR_TMP . '/index.html');
}
return DIR_TMP;
}
/**
* Adds content to a new line in a file. If a file is not there it will be created
* @param string $filename
* @param string $content
*/
public function append($filename, $content) {
file_put_contents($filename, $content, FILE_APPEND);
}
/**
* Just a consistency wrapper for file_get_contents
* Should use curl if it exists and fopen isn't allowed (thanks Remo)
* @param $filename
*/
public function getContents($file, $timeout = 5) {
$url = @parse_url($file);
if (isset($url['scheme']) && isset($url['host'])) {
if (ini_get('allow_url_fopen')) {
$ctx = stream_context_create(array(
'http' => array( 'timeout' => $timeout )
));
if ($contents = @file_get_contents($file, 0, $ctx)) {
return $contents;
}
}
if (function_exists('curl_init')) {
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $file);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($curl_handle);
$http_code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
if ($http_code == 404) {
return false;
}
return $contents;
}
} else {
if ($contents = @file_get_contents($file)) {
return $contents;
}
}
return false;
}
/**
* Removes contents of the file
* @param $filename
*/
public function clear($file) {
file_put_contents($file, '');
}
/**
* Cleans up a filename and returns the cleaned up version
*/
public function sanitize($file) {
//return preg_replace(array("/[^0-9A-Za-z-.]/","/[\s]/"),"", $file);
//$file = preg_replace("/[^0-9A-Z_a-z-.\s]/","", $file);
$file = preg_replace("/[<>&#]/","", $file);
return trim($file);
}
/**
* Returns the extension for a file name
* @param $filename
*/
public function getExtension($filename) {
$extension = end(explode(".",$filename));
return $extension;
}
/**
* Takes a path and replaces the files extension in that path with the specified extension
*/
public function replaceExtension($filename, $extension) {
$newFileName = substr($filename, 0, strrpos($filename, '.')) . '.' . $extension;
return $newFileName;
}
}
?>
お伺いのhelpers/file.phpとは、concrete5.6.1.2.ja/helpers/file.phpのことでしたでしょうか。
上記のものですと、内容は下記のようになっておりました。
度々お伺いし、申し訳ありませんが、どうかよろしくお願い申し上げます。
(?php
/**
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
/**
* Functions useful for working with files and directories.
* @package Helpers
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*/
defined('C5_EXECUTE') or die("Access Denied.");
Loader::element('func_mb_filename');
class SiteFileHelper extends FileHelper {
/**
* @access private
*/
protected $ignoreFiles = array('__MACOSX', DIRNAME_CONTROLLERS);
/**
* Returns the contents of a directory in an array.
* @param string $directory
* @return array
*/
public function getDirectoryContents($dir, $ignoreFilesArray = array()) {
$this->ignoreFiles = array_merge($this->ignoreFiles, $ignoreFilesArray);
$aDir = array();
if (is_dir($dir)) {
$handle = opendir($dir);
while(($file = readdir($handle)) !== false) {
if (substr($file, 0, 1) != '.' && (!in_array($file, $this->ignoreFiles))) {
$aDir[] = $file;
}
}
}
return $aDir;
}
/**
* Removes the extension of a filename, uncamelcases it.
* @param string $filename
* @return string
*/
public function unfilename($filename) {
// removes the extension and makes it look nice
$txt = Loader::helper('text');
return substr($txt->unhandle($filename), 0, strrpos($filename, '.'));
}
/**
* Recursively copies all items in the source directory to the target directory
* @param string $source
* @param string $target
*/
public function copyAll($source, $target, $mode = 0777) {
if (is_dir($source)) {
@mkdir($target, $mode);
@chmod($target, $mode);
$d = dir($source);
while (FALSE !== ($entry = $d->read())) {
if ( $entry == '.' || $entry == '..' || substr($entry, 0, 1) == '.') {
continue;
}
$Entry = $source . '/' . $entry;
if (is_dir($Entry)) {
$this->copyAll($Entry, $target . '/' . $entry, $mode);
continue;
}
copy($Entry, $target . '/' . $entry);
chmod($target . '/' . $entry, $mode);
}
$d->close();
} else {
copy($source, $target);
chmod($target, $mode);
}
}
/**
* Takes a path to a file and sends it to the browser, streaming it, and closing the HTTP connection afterwards. Basically a force download method
*/
public function forceDownload($file, $download_filename = false) {
$handle = @fopen($file, 'rb');
if ($handle === false) {
// Not Found
header('HTTP/1.1 404 Not Found');
return false;
}
header('Content-type: application/octet-stream');
//$h = Loader::helper('mime');
//$mimeType = $h->mimeFromExtension($this->getExtension($file));
//header('Content-type: ' . $mimeType);
if($download_filename){
$filename = $download_filename;
}else{
$filename = basename($file);
}
$ua = $_SERVER['HTTP_USER_AGENT'];
if (strstr($ua, 'MSIE') && !strstr($ua, 'Opera')) {
$filename = mb_convert_encoding($filename, "SJIS", APP_CHARSET);
}
header("Content-Disposition: attachment; filename=\"$filename\"");
header('Content-Length: ' . filesize($file));
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Transfer-Encoding: binary");
$buffer = '';
$chunk = 1024*1024;
while (!feof($handle)) {
$buffer = fread($handle, $chunk);
print $buffer;
}
fclose($handle);
exit;
}
/**
* Returns the full path to the temporary directory
*/
public function getTemporaryDirectory() {
if (!is_dir(DIR_TMP)) {
mkdir(DIR_TMP, 0777);
touch(DIR_TMP . '/index.html');
}
return DIR_TMP;
}
/**
* Adds content to a new line in a file. If a file is not there it will be created
* @param string $filename
* @param string $content
*/
public function append($filename, $content) {
file_put_contents($filename, $content, FILE_APPEND);
}
/**
* Just a consistency wrapper for file_get_contents
* Should use curl if it exists and fopen isn't allowed (thanks Remo)
* @param $filename
*/
public function getContents($file, $timeout = 5) {
$url = @parse_url($file);
if (isset($url['scheme']) && isset($url['host'])) {
if (ini_get('allow_url_fopen')) {
$ctx = stream_context_create(array(
'http' => array( 'timeout' => $timeout )
));
if ($contents = @file_get_contents($file, 0, $ctx)) {
return $contents;
}
}
if (function_exists('curl_init')) {
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $file);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($curl_handle);
$http_code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
if ($http_code == 404) {
return false;
}
return $contents;
}
} else {
if ($contents = @file_get_contents($file)) {
return $contents;
}
}
return false;
}
/**
* Removes contents of the file
* @param $filename
*/
public function clear($file) {
file_put_contents($file, '');
}
/**
* Cleans up a filename and returns the cleaned up version
*/
public function sanitize($file) {
//return preg_replace(array("/[^0-9A-Za-z-.]/","/[\s]/"),"", $file);
//$file = preg_replace("/[^0-9A-Z_a-z-.\s]/","", $file);
$file = preg_replace("/[<>&#]/","", $file);
return trim($file);
}
/**
* Returns the extension for a file name
* @param $filename
*/
public function getExtension($filename) {
$extension = end(explode(".",$filename));
return $extension;
}
/**
* Takes a path and replaces the files extension in that path with the specified extension
*/
public function replaceExtension($filename, $extension) {
$newFileName = substr($filename, 0, strrpos($filename, '.')) . '.' . $extension;
return $newFileName;
}
}
?>
Your post has been saved and will be published after approval by the forum moderator.
acliss
Re: Fatal error: Class 'FileHelper' not found in...について
エラーが起こった間に何か作業はされていませんか?
例)
○○パッケージをインストールした。
○○ファイルを書き換えた。
ファイルのパーミッションを変更した。
など