Changeset 22058 for branches/version-2_12-multilang/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php
- Timestamp:
- 2012/10/22 19:42:42 (11 years ago)
- Location:
- branches/version-2_12-multilang
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-multilang
- Property svn:mergeinfo changed
/branches/version-2_12-dev (added) merged: 22001-22004,22010-22012,22014-22029,22033-22039,22042-22044,22050-22057 /branches/version-2_12_2 (added) merged: 21999-22000,22008-22009
- Property svn:mergeinfo changed
-
branches/version-2_12-multilang/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php
r21981 r22058 74 74 $objFormParam->setParam($_POST); 75 75 76 $mode = $this->getMode();77 78 76 switch ($mode) { 79 77 // インストール … … 82 80 $this->arrErr = $this->checkUploadFile($file_key); 83 81 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']; 86 83 // インストール処理. 87 $this->arrErr = $this->installPlugin($ upload_file_file_name, 'plugin_file');84 $this->arrErr = $this->installPlugin($archive_file_name, 'plugin_file'); 88 85 if ($this->isError($this->arrErr) === false) { 89 86 // コンパイルファイルのクリア処理 … … 112 109 // 有効化 113 110 case 'enable': 114 115 111 // エラーチェック 116 112 $this->arrErr = $objFormParam->checkError(); … … 152 148 $this->arrErr = $objFormParam->checkError(); 153 149 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']; // アップデート対象のプラグインコード 155 153 $this->arrErr = $this->checkUploadFile($target_plugin_code); 156 154 … … 197 195 $plugins[$key]['logo'] = ROOT_URLPATH . 'plugin/' . $plugins[$key]['plugin_code'] . '/logo.png'; 198 196 } else { 199 $plugins[$key]['logo'] = IMAGE_SAVE_URLPATH . 'noimage_plugin_list. gif';197 $plugins[$key]['logo'] = IMAGE_SAVE_URLPATH . 'noimage_plugin_list.png'; 200 198 } 201 199 … … 229 227 $objFormParam->addParam('mode', 'mode', INT_LEN, '', array('ALPHA_CHECK', 'MAX_LENGTH_CHECK')); 230 228 $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'));232 229 if ($mode === 'priority') { 233 230 $objFormParam->addParam('優先度', 'priority', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); … … 315 312 */ 316 313 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; 319 316 } 320 317 … … 323 320 * 324 321 * @param string $plugin_code プラグインコード 322 * @param string $plugin_class プラグインクラス名 325 323 * @return string $plugin_file_path クラスファイルのパス. 326 324 */ 327 function getPluginFilePath($plugin_code ) {328 $plugin_file_path = $this->getPluginDir($plugin_code) . $plugin_c ode. '.php';325 function getPluginFilePath($plugin_code , $plugin_class) { 326 $plugin_file_path = $this->getPluginDir($plugin_code) . $plugin_class . '.php'; 329 327 return $plugin_file_path; 330 328 } … … 333 331 * プラグインをインストールします. 334 332 * 335 * @param string $ plugin_code プラグインコード.333 * @param string $archive_file_name アーカイブファイル名. 336 334 * @param string $key キー. 337 335 * @return array エラー情報を格納した連想配列. 338 336 */ 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 343 344 //シンタックスエラーがあるtar.gzをアップ後、削除するとたまにディレクトリが消えるので追加 344 345 $this->makeDir(PLUGIN_UPLOAD_REALDIR); … … 351 352 } 352 353 // ファイルをチェックし一時展開用ディレクトリに展開します. 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); 354 355 if ($this->isError($arrErr) === true) { 355 356 return $arrErr; … … 372 373 } 373 374 374 // プラグインコード375 $plugin_code = $arrPluginInfo['PLUGIN_CODE'];376 // プラグイン名377 $plugin_name = $arrPluginInfo['PLUGIN_NAME'];378 379 375 // 既にインストールされていないかを判定. 380 if ($this->isInstalledPlugin($ plugin_code) === true) {376 if ($this->isInstalledPlugin($arrPluginInfo['PLUGIN_CODE']) === true) { 381 377 $this->rollBack(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR); 382 $arrErr['plugin_file'] = '※ ' . $ plugin_name. 'は既にインストールされています。<br/>';378 $arrErr['plugin_file'] = '※ ' . $arrPluginInfo['PLUGIN_NAME'] . 'は既にインストールされています。<br/>'; 383 379 return $arrErr; 384 380 } … … 392 388 393 389 // プラグイン保存ディレクトリを作成し、一時展開用ディレクトリから移動します. 394 $plugin_dir_path = PLUGIN_UPLOAD_REALDIR . $plugin_code . '/';390 $plugin_dir_path = $this->getPluginDir($arrPluginInfo['PLUGIN_CODE']); 395 391 $this->makeDir($plugin_dir_path); 396 392 SC_Utils_Ex::copyDirectory(DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR, $plugin_dir_path); 397 393 398 394 // プラグイン情報を取得 399 $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($ plugin_code);395 $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($arrPluginInfo['PLUGIN_CODE']); 400 396 401 397 // クラスファイルを読み込み. 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']); 403 399 $arrErr = $this->requirePluginFile($plugin_class_file_path, $key); 404 400 if ($this->isError($arrErr) === true) { … … 407 403 } 408 404 // プラグイン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); 411 407 412 408 $arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'install'); 413 409 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); 415 411 return $arrErr; 416 412 } … … 427 423 * @param string $temp_dir インストール・アップデート時の一時展開用ディレクトリのパス. 428 424 * @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 ='') { 432 428 // 一時ディレクトリを削除. 433 429 SC_Helper_FileManager_Ex::deleteFile($temp_dir, false); … … 437 433 } 438 434 // 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); 441 437 } 442 438 } … … 483 479 * 484 480 * @param ReflectionClass $objReflection リフレクションオブジェクト 481 * @param string $dir_path チェックするプラグインディレクトリ 485 482 * @return array エラー情報を格納した連想配列. 486 483 */ 487 function checkPluginConstants(ReflectionClass $objReflection, $ unpack_dir) {484 function checkPluginConstants(ReflectionClass $objReflection, $dir_path) { 488 485 $arrErr = array(); 489 486 // プラグイン情報を取得 … … 502 499 return $arrErr; 503 500 } 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) { 506 503 $arrErr['plugin_file'] = '※ CLASS_NAMEが正しく定義されていません。<br/>'; 507 504 return $arrErr; … … 550 547 * プラグインをアップデートします. 551 548 * 552 * @param string $target_plugin アップデートするプラグインコード.549 * @param array $target_plugin アップデートするプラグイン情報の配列. 553 550 * @param string $upload_file_name アップロードファイル名. 554 551 * @return array エラー情報を格納した連想配列. … … 598 595 * 599 596 * @param string $unpack_file_name 解凍ファイル名 600 * @param string $unpack_dir 解凍先ディレクトリ597 * @param string $unpack_dir_path 解凍先ディレクトリパス 601 598 * @param string $file_key ファイルキー 602 599 * @return array エラー情報を格納した連想配列. 603 600 */ 604 function unpackPluginFile($unpack_file_name, $unpack_dir , $file_key) {601 function unpackPluginFile($unpack_file_name, $unpack_dir_path, $file_key) { 605 602 $arrErr = array(); 606 603 // 解凍ディレクトリディレクトリを作成し、一時ディレクトリからファイルを移動 607 $objUpFile = new SC_UploadFile_Ex(PLUGIN_TEMP_REALDIR, $unpack_dir );604 $objUpFile = new SC_UploadFile_Ex(PLUGIN_TEMP_REALDIR, $unpack_dir_path); 608 605 $this->initUploadFile($objUpFile, $file_key); 609 606 $arrErr = $objUpFile->makeTempFile($file_key, false); … … 619 616 $objUpFile->moveTempFile(); 620 617 // 解凍 621 $u pdate_plugin_file_path = $unpack_dir. $unpack_file_name;622 if (!$this->unpackPluginArchive($u pdate_plugin_file_path)) {618 $unpack_file_path = $unpack_dir_path . $unpack_file_name; 619 if (!$this->unpackPluginArchive($unpack_file_path)) { 623 620 $arrErr['plugin_file'] = '※ 解凍に失敗しました。<br/>'; 624 621 return $arrErr; … … 636 633 $arrErr = array(); 637 634 // プラグインファイルを読み込みます. 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']); 639 636 $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 640 637 if ($this->isError($arrErr) === true) { … … 670 667 $arrErr = array(); 671 668 // クラスファイルを読み込み. 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']); 673 670 $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 674 671 if ($this->isError($arrErr) === true) { … … 695 692 $arrErr = array(); 696 693 // クラスファイルを読み込み. 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']); 698 695 $arrErr = $this->requirePluginFile($plugin_class_file_path, 'plugin_error'); 699 696 if ($this->isError($arrErr) === true) { … … 859 856 $result = $tar->extractModify($dir. '/', $unpacking_name); 860 857 GC_Utils_Ex::gfPrintLog('解凍:' . $dir.'/'.$file_name.'->'.$dir.'/'.$unpacking_name); 861 858 // 解凍元のファイルを削除する. 859 unlink($path); 860 862 861 return $result; 863 862 }
Note: See TracChangeset
for help on using the changeset viewer.