Răsfoiți Sursa

#31 - Check and Change permissions actions removing.

AntonLV 12 ani în urmă
părinte
comite
d6bf71dbd1

+ 0 - 2
modules/boonex/english/data/langs/system.xml

@@ -1216,12 +1216,10 @@
 	<string name="_adm_txt_module_custom"><![CDATA[Custom]]></string>
 	<string name="_adm_txt_module_custom"><![CDATA[Custom]]></string>
 	<string name="_adm_txt_module_skeletons"><![CDATA[Skeletons]]></string>
 	<string name="_adm_txt_module_skeletons"><![CDATA[Skeletons]]></string>
 	<string name="_adm_txt_module_system"><![CDATA[System]]></string>
 	<string name="_adm_txt_module_system"><![CDATA[System]]></string>
-	<string name="_adm_txt_modules_change_permissions"><![CDATA[Changing permissions:]]></string>
 	<string name="_adm_txt_modules_check_dependencies"><![CDATA[Check module dependencies:]]></string>
 	<string name="_adm_txt_modules_check_dependencies"><![CDATA[Check module dependencies:]]></string>
 	<string name="_adm_txt_modules_check_module_exists"><![CDATA[Check module for existence:]]></string>
 	<string name="_adm_txt_modules_check_module_exists"><![CDATA[Check module for existence:]]></string>
 	<string name="_adm_txt_modules_check_module_hash"><![CDATA[Check module hash:]]></string>
 	<string name="_adm_txt_modules_check_module_hash"><![CDATA[Check module hash:]]></string>
 	<string name="_adm_txt_modules_check_module_version"><![CDATA[Check module version:]]></string>
 	<string name="_adm_txt_modules_check_module_version"><![CDATA[Check module version:]]></string>
-	<string name="_adm_txt_modules_check_permissions"><![CDATA[Checking permissions:]]></string>
 	<string name="_adm_txt_modules_check_script_version"><![CDATA[Check the Dolphin version for compatibility:]]></string>
 	<string name="_adm_txt_modules_check_script_version"><![CDATA[Check the Dolphin version for compatibility:]]></string>
 	<string name="_adm_txt_modules_clear_db_cache"><![CDATA[Clear database cache:]]></string>
 	<string name="_adm_txt_modules_clear_db_cache"><![CDATA[Clear database cache:]]></string>
 	<string name="_adm_txt_modules_delete"><![CDATA[Delete]]></string>
 	<string name="_adm_txt_modules_delete"><![CDATA[Delete]]></string>

+ 0 - 1
modules/boonex/russian/data/langs/system.xml

@@ -2417,7 +2417,6 @@ Without doing that you won't be submitted to our database.</p>
 	<string name="_adm_txt_modules_check_script_version"><![CDATA[Check the Dolphin version for compatibility:]]></string>
 	<string name="_adm_txt_modules_check_script_version"><![CDATA[Check the Dolphin version for compatibility:]]></string>
 	<string name="_adm_txt_modules_check_dependencies"><![CDATA[Check module dependencies:]]></string>
 	<string name="_adm_txt_modules_check_dependencies"><![CDATA[Check module dependencies:]]></string>
 	<string name="_adm_txt_modules_show_introduction"><![CDATA[Introduction from vendor:]]></string>
 	<string name="_adm_txt_modules_show_introduction"><![CDATA[Introduction from vendor:]]></string>
-	<string name="_adm_txt_modules_change_permissions"><![CDATA[Checking permissions:]]></string>
 	<string name="_adm_txt_modules_move_sources"><![CDATA[Move source files:]]></string>
 	<string name="_adm_txt_modules_move_sources"><![CDATA[Move source files:]]></string>
 	<string name="_adm_txt_modules_execute_sql"><![CDATA[Changing database:]]></string>
 	<string name="_adm_txt_modules_execute_sql"><![CDATA[Changing database:]]></string>
 	<string name="_adm_txt_modules_install_language"><![CDATA[Install language:]]></string>
 	<string name="_adm_txt_modules_install_language"><![CDATA[Install language:]]></string>

+ 0 - 72
studio/classes/BxDolStudioInstaller.php

@@ -90,12 +90,6 @@ class BxDolStudioInstaller extends BxDolInstallerUtils
             'show_introduction' => array(
             'show_introduction' => array(
                 'title' => _t('_adm_txt_modules_show_introduction'),
                 'title' => _t('_adm_txt_modules_show_introduction'),
             ),
             ),
-            'check_permissions' => array(
-                'title' => _t('_adm_txt_modules_check_permissions'),
-            ),
-            'change_permissions' => array(
-                'title' => _t('_adm_txt_modules_change_permissions'),
-            ),
             'move_sources' => array(
             'move_sources' => array(
                 'title' => _t('_adm_txt_modules_move_sources'),
                 'title' => _t('_adm_txt_modules_move_sources'),
             ),
             ),
@@ -545,72 +539,6 @@ class BxDolStudioInstaller extends BxDolInstallerUtils
         $sPath = $this->_sHomePath . 'install/info/' . $this->_aConfig[$sOperation . '_info']['conclusion'];
         $sPath = $this->_sHomePath . 'install/info/' . $this->_aConfig[$sOperation . '_info']['conclusion'];
         return file_exists($sPath) ? array("code" => BX_DOL_STUDIO_INSTALLER_SUCCESS, "content" => "<pre>" . file_get_contents($sPath) . "</pre>") : BX_DOL_STUDIO_INSTALLER_FAILED;
         return file_exists($sPath) ? array("code" => BX_DOL_STUDIO_INSTALLER_SUCCESS, "content" => "<pre>" . file_get_contents($sPath) . "</pre>") : BX_DOL_STUDIO_INSTALLER_FAILED;
     }
     }
-    function actionCheckPermissions($sOperation)
-    {
-        if(!isset($this->_aConfig[$sOperation . '_permissions']) || !is_array($this->_aConfig[$sOperation . '_permissions']))
-            return BX_DOL_STUDIO_INSTALLER_FAILED;
-
-        $aResult = array();
-        $aPermissions = $this->_aConfig[$sOperation . '_permissions'];
-        foreach($aPermissions as $sPermissions => $aFiles) {
-            $sCheckFunction = 'is' . ucfirst($sPermissions);
-            $sCptPermissions = _t('_adm_txt_modules_' . $sPermissions);
-            foreach($aFiles as $sFile)
-                if(!BxDolInstallerUtils::$sCheckFunction(str_replace(BX_DIRECTORY_PATH_ROOT, '', $this->_sModulePath . $sFile)))
-                    $aResult[] = array('path' => $this->_sModulePath . $sFile, 'permissions' => $sCptPermissions);
-        }
-        return empty($aResult) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => $aResult);
-    }
-    function actionCheckPermissionsFailed($mixedResult)
-    {
-        $sResult = '<br />' . _t('_adm_err_modules_wrong_permissions_check') . '<br />';
-        foreach($mixedResult['content'] as $aFile)
-            $sResult .= _t('_adm_err_modules_wrong_permissions_msg', $aFile['path'], $aFile['permissions']) . '<br />';
-        return $sResult;
-    }
-    function actionChangePermissions($sOperation)
-    {
-        if(!isset($this->_aConfig[$sOperation . '_permissions']) || !is_array($this->_aConfig[$sOperation . '_permissions']))
-            return BX_DOL_STUDIO_INSTALLER_FAILED;
-
-        $aChangeItems = array();
-        $aPermissions = $this->_aConfig[$sOperation . '_permissions'];
-        foreach($aPermissions as $sPermissions => $aFiles) {
-            $sCheckFunction = 'is' . ucfirst($sPermissions);
-            foreach($aFiles as $sFile) {
-                $sPath = bx_ltrim_str($this->_sModulePath . $sFile, BX_DIRECTORY_PATH_ROOT);
-                if(BxDolInstallerUtils::$sCheckFunction($sPath))
-                    continue;
-
-                $aChangeItems[] = array('file' => $sFile, 'path' => $sPath, 'permissions' => $sPermissions);
-            }
-        }
-
-        if(empty($aChangeItems))
-            return BX_DOL_STUDIO_INSTALLER_SUCCESS;
-
-        $oFile = $this->_getFileManager();
-        if(empty($oFile))
-            return array('code' => BX_DOL_STUDIO_INSTALLER_FAILED);
-
-        $aResult = array();
-        foreach($aChangeItems as $aChangeItem)
-            if(!$oFile->setPermissions($aChangeItem['path'], $aChangeItem['permissions']))
-                $aResult[] = array('path' => $this->_sModulePath . $aChangeItem['file'], 'permissions' => $aChangeItem['permissions']);
-
-        return empty($aResult) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => $aResult);
-    }
-    function actionChangePermissionsFailed($mixedResult)
-    {
-        if(empty($mixedResult['content']))
-            return $this->actionOperationFailed($mixedResult);
-
-        $sResult = '<br />' . _t('_adm_err_modules_wrong_permissions_change') . '<br />';
-        foreach($mixedResult['content'] as $aFile)
-            $sResult .= _t('_adm_err_modules_wrong_permissions_msg', $aFile['path'], $aFile['permissions']) . '<br />';
-
-        return $sResult;
-    }
     function actionMoveSources($sOperation)
     function actionMoveSources($sOperation)
     {
     {
         $oFile = $this->_getFileManager();
         $oFile = $this->_getFileManager();

+ 7 - 2
studio/classes/BxDolStudioInstallerUtils.php

@@ -138,7 +138,7 @@ class BxDolStudioInstallerUtils extends BxDolInstallerUtils implements iBxDolSin
 
 
     public function perform($sDirectory, $sOperation, $aParams = array())
     public function perform($sDirectory, $sOperation, $aParams = array())
     {
     {
-    	if(!defined('BX_DOL_CRON_EXECUTE') && !self::isRealOwner() && !in_array($sOperation, array('enable', 'disable'))) {
+    	if(!defined('BX_DOL_CRON_EXECUTE') && !self::isRealOwner() && !in_array($sOperation, array('install', 'uninstall', 'enable', 'disable'))) {
     		if($this->addTransientJob('perform_action', array($sDirectory, $sOperation, $aParams)))
     		if($this->addTransientJob('perform_action', array($sDirectory, $sOperation, $aParams)))
     			return array('code' => 1, 'message' => _t('_adm_mod_msg_process_operation_scheduled'));
     			return array('code' => 1, 'message' => _t('_adm_mod_msg_process_operation_scheduled'));
     		else 
     		else 
@@ -261,8 +261,9 @@ class BxDolStudioInstallerUtils extends BxDolInstallerUtils implements iBxDolSin
 
 
     protected function performWrite($aItem, &$sFilePath)
     protected function performWrite($aItem, &$sFilePath)
     {
     {
-    	$sFilePath = BX_DIRECTORY_PATH_TMP . $aItem['name'];
+    	$iUmaskSave = umask(0);
 
 
+    	$sFilePath = BX_DIRECTORY_PATH_TMP . $aItem['name'];
     	if(file_exists($sFilePath))
     	if(file_exists($sFilePath))
         	@unlink($sFilePath);
         	@unlink($sFilePath);
 
 
@@ -275,11 +276,14 @@ class BxDolStudioInstallerUtils extends BxDolInstallerUtils implements iBxDolSin
 
 
         fclose($rHandler);
         fclose($rHandler);
         
         
+        umask($iUmaskSave);
         return true;
         return true;
     }
     }
 
 
     protected function performUnarchive($sFilePath, &$sPackagePath)
     protected function performUnarchive($sFilePath, &$sPackagePath)
     {
     {
+    	$iUmaskSave = umask(0);
+
     	if(!class_exists('ZipArchive'))
     	if(!class_exists('ZipArchive'))
             return _t('_adm_str_err_zip_not_available');
             return _t('_adm_str_err_zip_not_available');
 
 
@@ -303,6 +307,7 @@ class BxDolStudioInstallerUtils extends BxDolInstallerUtils implements iBxDolSin
 
 
         $oZip->close();
         $oZip->close();
 
 
+        umask($iUmaskSave);
         return true;
         return true;
     }
     }