pluginInstallDir() public static method

public static pluginInstallDir ( )
Exemplo n.º 1
0
 public function downloadPlugins()
 {
     ipRequest()->mustBePost();
     $plugins = ipRequest()->getPost('plugins');
     if (!is_writable(Model::pluginInstallDir())) {
         return JsonRpc::error(__('Directory is not writable. Please check your email and install the plugin manually.', 'Ip-admin', false), 777);
     }
     try {
         if (!is_array($plugins)) {
             return JsonRpc::error(__('Download failed: invalid parameters', 'Ip-admin', false), 101);
         }
         if (function_exists('set_time_limit')) {
             set_time_limit(count($plugins) * 180 + 30);
         }
         $pluginDownloader = new PluginDownloader();
         foreach ($plugins as $plugin) {
             if (!empty($plugin['url']) && !empty($plugin['name']) && !empty($plugin['signature'])) {
                 $pluginDownloader->downloadPlugin($plugin['name'], $plugin['url'], $plugin['signature']);
             }
         }
     } catch (\Ip\Exception $e) {
         return JsonRpc::error($e->getMessage(), $e->getCode());
     } catch (\Exception $e) {
         return JsonRpc::error(__('Unknown error. Please see logs.', 'Ip-admin', false), 987);
     }
     return JsonRpc::result(array('plugins' => $plugins));
 }