Exemplo n.º 1
0
 /**
  * @EXT\Route(
  *     "/",
  *     name="claro_admin_plugins",
  *     options = {"expose"=true}
  * )
  *
  * @EXT\Template()
  *
  * Display the plugin list
  *
  * @return Response
  */
 public function listAction()
 {
     $fs = new FileSystem();
     $rootPath = $this->container->getParameter('claroline.param.root_directory') . '/';
     $danger = array('simple' => array(realpath($rootPath . 'vendor/composer/autoload_namespaces.php') => is_writable(realpath($rootPath . 'vendor/composer/autoload_namespaces.php')), realpath($rootPath . 'app/config/bundles.ini') => is_writable(realpath($rootPath . 'app/config/bundles.ini')), realpath($rootPath . 'vendor') => is_writable(realpath($rootPath . 'vendor')), realpath($rootPath . 'app/logs') => is_writable(realpath($rootPath . 'app/logs')), realpath($rootPath . 'web/bundles') => is_writable(realpath($rootPath . 'web/bundles'))), 'recursive' => array(realpath($rootPath . 'web/js') => $fs->isWritable(realpath($rootPath . 'web/js'), true), realpath($rootPath . 'app/cache') => $fs->isWritable(realpath($rootPath . 'app/cache'), true), realpath($rootPath . 'web/themes') => $fs->isWritable(realpath($rootPath . 'web/themes'), true), realpath($rootPath . 'web/css') => $fs->isWritable(realpath($rootPath . 'web/css'), true), realpath($rootPath . 'web/vendor') => $fs->isWritable(realpath($rootPath . 'web/vendor'), true)));
     $refresh = array('simple' => array(realpath($rootPath . 'web/bundles') => is_writable(realpath($rootPath . 'web/bundles'))), 'recursive' => array(realpath($rootPath . 'web/js') => $fs->isWritable(realpath($rootPath . 'web/js'), true), realpath($rootPath . 'web/themes') => $fs->isWritable(realpath($rootPath . 'web/themes'), true), realpath($rootPath . 'web/css') => $fs->isWritable(realpath($rootPath . 'web/css'), true), realpath($rootPath . 'web/vendor') => $fs->isWritable(realpath($rootPath . 'web/vendor'), true)));
     $coreBundle = $this->bundleManager->getBundle('CoreBundle');
     $coreVersion = $coreBundle->getVersion();
     $api = $this->configHandler->getParameter('repository_api');
     $url = $api . "/version/{$coreVersion}/tags/last";
     if ($this->configHandler->getParameter('use_repository_test')) {
         $url .= '/test';
     }
     //ask the server wich are the last available packages now.
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $data = curl_exec($ch);
     curl_close($ch);
     $fetched = json_decode($data);
     $installed = $this->bundleManager->getInstalled();
     $plugins = $this->bundleManager->getConfigurablePlugins();
     foreach ($installed as $install) {
         foreach ($plugins as $plugin) {
             if ($plugin->getBundleName() === $install->getName()) {
                 $install->setIsConfigurable(true);
             }
         }
     }
     $uninstalled = $this->bundleManager->getUninstalledFromServer($fetched);
     return array('fetched' => $fetched, 'installed' => $installed, 'uninstalled' => $uninstalled, 'danger' => $danger, 'refresh' => $refresh, 'useTestRepo' => $this->configHandler->getParameter('use_repository_test'));
 }
Exemplo n.º 2
0
 public function renderMissingPermissions($basePath)
 {
     $fs = new FileSystem();
     $fullPath = realpath($this->vendorPath . '/' . $basePath);
     $basePath = realpath($this->vendorPath . '/' . substr($basePath, 0, strrpos($basePath, '/')));
     $fullPathElement = $basePathElement = '';
     $notWritable = $this->translator->trans('is_not_writable', array(), 'platform');
     $notWritableRecursive = $this->translator->trans('is_not_writable_recursive', array(), 'platform');
     if ($fullPath && !$fs->isWritable($fullPath, true)) {
         $fullPathElement = "<li class='alert alert-danger'>" . $fullPath . ' ' . $notWritableRecursive . "</li>";
     }
     if (!is_writable($basePath) && $basePath) {
         $basePathElement = "<li class='alert alert-danger'>" . $basePath . ' ' . $notWritable . "</li>";
     }
     $rendering = sprintf('<ul>%s%s</ul>', $fullPathElement, $basePathElement);
     return $rendering;
 }