Changeset 21877


Ignore:
Timestamp:
2012/06/01 18:50:41 (12 years ago)
Author:
tokuhiro
Message:

#1839 phpの文法に乗っ取ってない表記で書かれたソースでもプラグインとして読み込めるエラーの修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php

    r21872 r21877  
    341341        SC_Helper_FileManager_Ex::deleteFile(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, false); 
    342342         
     343        //シンタックスエラーがあるtar.gzをアップ後、削除するとたまにディレクトリが消えるので追加 
     344        $this->makeDir(PLUGIN_UPLOAD_REALDIR); 
     345 
    343346        $arrErr = array(); 
    344347        // ファイルをチェックし一時展開用ディレクトリに展開します. 
     
    629632        // プラグインファイルを読み込みます. 
    630633        $plugin_class_file_path = PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'] . '/' . $plugin['class_name'] . '.php'; 
    631         $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 
    632         if ($this->isError($arrErr) === true) { 
    633             return $arrErr; 
    634         } 
    635634         
    636635        // プラグインが有効な場合に無効化処理を実行 
     
    647646        // アンインストール処理を実行します. 
    648647        $arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'uninstall'); 
    649         if ($this->isError($arrErr) === true) { 
    650             return $arrErr; 
    651         } 
    652648        // プラグインの削除処理. 
    653649        $arrErr = $this->deletePlugin($plugin['plugin_id'], $plugin['plugin_code']); 
     
    806802        $arrErr = array(); 
    807803        if (file_exists($file_path)) { 
    808             require_once $file_path; 
     804            //requireだとファイルの存在チェックしかできないのでexecで実行してみる(syntax errorが見れる) 
     805            $result = exec("php -l " . $file_path); 
     806            //Errors parsingがあったらエラーを投げる 
     807            if(strpos($result, 'Errors parsing') !== false){ 
     808                $arrErr[$key] = '※ ' . $file_path .'のソース内にエラーが発見されました<br/>'; 
     809            } else { 
     810                require $file_path; 
     811            } 
    809812        } else { 
    810813            $arrErr[$key] = '※ ' . $file_path .'の読み込みに失敗しました。<br/>'; 
Note: See TracChangeset for help on using the changeset viewer.