Ignore:
Timestamp:
2012/10/22 19:42:42 (11 years ago)
Author:
h_yoshimoto
Message:

#1955 r21998~r22057間のコミットをmerge

Location:
branches/version-2_12-multilang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-multilang

  • branches/version-2_12-multilang/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php

    r21981 r22058  
    7474        $objFormParam->setParam($_POST); 
    7575 
    76         $mode = $this->getMode(); 
    77  
    7876        switch ($mode) { 
    7977            // インストール 
     
    8280                $this->arrErr = $this->checkUploadFile($file_key); 
    8381                if ($this->isError($this->arrErr) === false) { 
    84                     $upload_file = $_FILES[$file_key]; 
    85                     $upload_file_file_name = $upload_file['name']; 
     82                    $archive_file_name = $_FILES[$file_key]['name']; 
    8683                    // インストール処理. 
    87                     $this->arrErr = $this->installPlugin($upload_file_file_name, 'plugin_file'); 
     84                    $this->arrErr = $this->installPlugin($archive_file_name, 'plugin_file'); 
    8885                    if ($this->isError($this->arrErr) === false) { 
    8986                        // コンパイルファイルのクリア処理 
     
    112109            // 有効化 
    113110            case 'enable': 
    114  
    115111                // エラーチェック 
    116112                $this->arrErr = $objFormParam->checkError(); 
     
    152148                $this->arrErr = $objFormParam->checkError(); 
    153149                if ($this->isError($this->arrErr) === false) { 
    154                     $target_plugin_code = $objFormParam->getValue('plugin_code'); // アップデート対象のプラグインコード 
     150                    $plugin_id = $objFormParam->getValue('plugin_id'); 
     151                    $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); 
     152                    $target_plugin_code = $plugin['plugin_code']; // アップデート対象のプラグインコード 
    155153                    $this->arrErr = $this->checkUploadFile($target_plugin_code); 
    156154 
     
    197195                $plugins[$key]['logo'] = ROOT_URLPATH . 'plugin/' . $plugins[$key]['plugin_code'] . '/logo.png'; 
    198196            } else { 
    199                 $plugins[$key]['logo'] = IMAGE_SAVE_URLPATH . 'noimage_plugin_list.gif'; 
     197                $plugins[$key]['logo'] = IMAGE_SAVE_URLPATH . 'noimage_plugin_list.png'; 
    200198            } 
    201199 
     
    229227        $objFormParam->addParam('mode', 'mode', INT_LEN, '', array('ALPHA_CHECK', 'MAX_LENGTH_CHECK')); 
    230228        $objFormParam->addParam('plugin_id', 'plugin_id', INT_LEN, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); 
    231         $objFormParam->addParam('plugin_code', 'plugin_code', MTEXT_LEN, '', array('ALNUM_CHECK', 'MAX_LENGTH_CHECK')); 
    232229        if ($mode === 'priority') { 
    233230            $objFormParam->addParam('優先度', 'priority', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); 
     
    315312     */ 
    316313    function getHtmlPluginDir($plugin_code) { 
    317         $plugin_dir_path = PLUGIN_HTML_REALDIR . $plugin_code . '/'; 
    318         return $plugin_dir_path; 
     314        $plugin_html_dir_path = PLUGIN_HTML_REALDIR . $plugin_code . '/'; 
     315        return $plugin_html_dir_path; 
    319316    } 
    320317 
     
    323320     * 
    324321     * @param string $plugin_code プラグインコード 
     322     * @param string $plugin_class プラグインクラス名 
    325323     * @return string $plugin_file_path クラスファイルのパス. 
    326324     */ 
    327     function getPluginFilePath($plugin_code) { 
    328         $plugin_file_path = $this->getPluginDir($plugin_code) . $plugin_code . '.php'; 
     325    function getPluginFilePath($plugin_code , $plugin_class) { 
     326        $plugin_file_path = $this->getPluginDir($plugin_code) . $plugin_class . '.php'; 
    329327        return $plugin_file_path; 
    330328    } 
     
    333331     * プラグインをインストールします. 
    334332     * 
    335      * @param string $plugin_code プラグインコード. 
     333     * @param string $archive_file_name アーカイブファイル名. 
    336334     * @param string $key キー. 
    337335     * @return array エラー情報を格納した連想配列. 
    338336     */ 
    339     function installPlugin($upload_file_file_name, $key) { 
    340         // インストール前に不要なファイルを消しておきます. 
    341         SC_Helper_FileManager_Ex::deleteFile(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, false); 
    342  
     337    function installPlugin($archive_file_name, $key) { 
     338        // 一時展開ディレクトリにファイルがある場合は事前に削除. 
     339        $arrFileHash = SC_Helper_FileManager_Ex::sfGetFileList(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR); 
     340        if(count($arrFileHash) > 0) { 
     341            SC_Helper_FileManager_Ex::deleteFile(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, false); 
     342        } 
     343         
    343344        //シンタックスエラーがあるtar.gzをアップ後、削除するとたまにディレクトリが消えるので追加 
    344345        $this->makeDir(PLUGIN_UPLOAD_REALDIR); 
     
    351352        } 
    352353        // ファイルをチェックし一時展開用ディレクトリに展開します. 
    353         $arrErr = $this->unpackPluginFile($upload_file_file_name, DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, $key); 
     354        $arrErr = $this->unpackPluginFile($archive_file_name, DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, $key); 
    354355        if ($this->isError($arrErr) === true) { 
    355356            return $arrErr; 
     
    372373        } 
    373374 
    374         // プラグインコード 
    375         $plugin_code = $arrPluginInfo['PLUGIN_CODE']; 
    376         // プラグイン名 
    377         $plugin_name = $arrPluginInfo['PLUGIN_NAME']; 
    378  
    379375        // 既にインストールされていないかを判定. 
    380         if ($this->isInstalledPlugin($plugin_code) === true) { 
     376        if ($this->isInstalledPlugin($arrPluginInfo['PLUGIN_CODE']) === true) { 
    381377            $this->rollBack(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR); 
    382             $arrErr['plugin_file'] = '※ ' . $plugin_name . 'は既にインストールされています。<br/>'; 
     378            $arrErr['plugin_file'] = '※ ' . $arrPluginInfo['PLUGIN_NAME'] . 'は既にインストールされています。<br/>'; 
    383379            return $arrErr; 
    384380        } 
     
    392388 
    393389        // プラグイン保存ディレクトリを作成し、一時展開用ディレクトリから移動します. 
    394         $plugin_dir_path = PLUGIN_UPLOAD_REALDIR . $plugin_code . '/'; 
     390        $plugin_dir_path = $this->getPluginDir($arrPluginInfo['PLUGIN_CODE']); 
    395391        $this->makeDir($plugin_dir_path); 
    396392        SC_Utils_Ex::copyDirectory(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, $plugin_dir_path); 
    397393 
    398394        // プラグイン情報を取得 
    399         $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($plugin_code); 
     395        $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($arrPluginInfo['PLUGIN_CODE']); 
    400396 
    401397        // クラスファイルを読み込み. 
    402         $plugin_class_file_path = $plugin_dir_path . $plugin['class_name'] . '.php'; 
     398        $plugin_class_file_path = $this->getPluginFilePath($plugin['plugin_code'], $plugin['class_name']); 
    403399        $arrErr = $this->requirePluginFile($plugin_class_file_path, $key); 
    404400        if ($this->isError($arrErr) === true) { 
     
    407403        } 
    408404        // プラグインhtmlディレクトリ作成 
    409         $plugin_html_dir = PLUGIN_HTML_REALDIR . $plugin_code; 
    410         $this->makeDir($plugin_html_dir); 
     405        $plugin_html_dir_path = $this->getHtmlPluginDir($plugin['plugin_code']); 
     406        $this->makeDir($plugin_html_dir_path); 
    411407 
    412408        $arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'install'); 
    413409        if ($this->isError($arrErr) === true) { 
    414             $this->rollBack(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, $plugin['plugin_id'], $plugin_html_dir); 
     410            $this->rollBack(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, $plugin['plugin_id'], $plugin_html_dir_path); 
    415411            return $arrErr; 
    416412        } 
     
    427423     * @param string $temp_dir インストール・アップデート時の一時展開用ディレクトリのパス. 
    428424     * @param string $plugin_id プラグインID. 
    429      * @param string $plugin_html_dir プラグイン毎に生成されるhtmlディレクトリのパス. 
    430      */ 
    431     function rollBack($temp_dir, $plugin_id = '', $plugin_html_dir ='') { 
     425     * @param string $plugin_html_dir_path プラグイン毎に生成されるhtmlディレクトリのパス. 
     426     */ 
     427    function rollBack($temp_dir, $plugin_id = '', $plugin_html_dir_path ='') { 
    432428        // 一時ディレクトリを削除. 
    433429        SC_Helper_FileManager_Ex::deleteFile($temp_dir, false); 
     
    437433        } 
    438434        // htmlディレクトリを削除 
    439         if (empty($plugin_html_dir) === false) { 
    440             SC_Helper_FileManager_Ex::deleteFile($plugin_html_dir, true); 
     435        if (empty($plugin_html_dir_path) === false) { 
     436            SC_Helper_FileManager_Ex::deleteFile($plugin_html_dir_path, true); 
    441437        } 
    442438    } 
     
    483479     * 
    484480     * @param ReflectionClass $objReflection リフレクションオブジェクト 
     481     * @param string $dir_path チェックするプラグインディレクトリ 
    485482     * @return array エラー情報を格納した連想配列. 
    486483     */ 
    487     function checkPluginConstants(ReflectionClass $objReflection, $unpack_dir) { 
     484    function checkPluginConstants(ReflectionClass $objReflection, $dir_path) { 
    488485        $arrErr = array(); 
    489486        // プラグイン情報を取得 
     
    502499            return $arrErr; 
    503500        } 
    504         $class_path = $unpack_dir . $arrPluginInfo['CLASS_NAME'] . '.php'; 
    505         if (file_exists($class_path) === false) { 
     501        $plugin_class_file_path = $dir_path . $arrPluginInfo['CLASS_NAME'] . '.php'; 
     502        if (file_exists($plugin_class_file_path) === false) { 
    506503            $arrErr['plugin_file'] = '※ CLASS_NAMEが正しく定義されていません。<br/>'; 
    507504            return $arrErr; 
     
    550547     * プラグインをアップデートします. 
    551548     * 
    552      * @param string $target_plugin アップデートするプラグインコード. 
     549     * @param array $target_plugin アップデートするプラグイン情報の配列. 
    553550     * @param string $upload_file_name アップロードファイル名. 
    554551     * @return array エラー情報を格納した連想配列. 
     
    598595     * 
    599596     * @param string $unpack_file_name 解凍ファイル名 
    600      * @param string $unpack_dir 解凍先ディレクトリ 
     597     * @param string $unpack_dir_path 解凍先ディレクトリパス 
    601598     * @param string $file_key ファイルキー 
    602599     * @return array エラー情報を格納した連想配列. 
    603600     */ 
    604     function unpackPluginFile($unpack_file_name, $unpack_dir, $file_key) { 
     601    function unpackPluginFile($unpack_file_name, $unpack_dir_path, $file_key) { 
    605602        $arrErr = array(); 
    606603        // 解凍ディレクトリディレクトリを作成し、一時ディレクトリからファイルを移動 
    607         $objUpFile = new SC_UploadFile_Ex(PLUGIN_TEMP_REALDIR, $unpack_dir); 
     604        $objUpFile = new SC_UploadFile_Ex(PLUGIN_TEMP_REALDIR, $unpack_dir_path); 
    608605        $this->initUploadFile($objUpFile, $file_key); 
    609606        $arrErr = $objUpFile->makeTempFile($file_key, false); 
     
    619616        $objUpFile->moveTempFile(); 
    620617        // 解凍 
    621         $update_plugin_file_path = $unpack_dir . $unpack_file_name; 
    622         if (!$this->unpackPluginArchive($update_plugin_file_path)) { 
     618        $unpack_file_path = $unpack_dir_path . $unpack_file_name; 
     619        if (!$this->unpackPluginArchive($unpack_file_path)) { 
    623620            $arrErr['plugin_file'] = '※ 解凍に失敗しました。<br/>'; 
    624621            return $arrErr; 
     
    636633        $arrErr = array(); 
    637634        // プラグインファイルを読み込みます. 
    638         $plugin_class_file_path = PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'] . '/' . $plugin['class_name'] . '.php'; 
     635        $plugin_class_file_path = $this->getPluginFilePath($plugin['plugin_code'], $plugin['class_name']); 
    639636        $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 
    640637        if ($this->isError($arrErr) === true) { 
     
    670667        $arrErr = array(); 
    671668        // クラスファイルを読み込み. 
    672         $plugin_class_file_path = PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'] . '/' . $plugin['class_name'] . '.php'; 
     669        $plugin_class_file_path = $this->getPluginFilePath($plugin['plugin_code'], $plugin['class_name']); 
    673670        $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 
    674671        if ($this->isError($arrErr) === true) { 
     
    695692        $arrErr = array(); 
    696693        // クラスファイルを読み込み. 
    697         $plugin_class_file_path = PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'] . '/' . $plugin['class_name'] . '.php'; 
     694        $plugin_class_file_path =$this->getPluginFilePath($plugin['plugin_code'], $plugin['class_name']); 
    698695        $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 
    699696        if ($this->isError($arrErr) === true) { 
     
    859856        $result = $tar->extractModify($dir. '/', $unpacking_name); 
    860857        GC_Utils_Ex::gfPrintLog('解凍:' . $dir.'/'.$file_name.'->'.$dir.'/'.$unpacking_name); 
    861  
     858        // 解凍元のファイルを削除する. 
     859        unlink($path); 
     860         
    862861        return $result; 
    863862    } 
Note: See TracChangeset for help on using the changeset viewer.