Remove a routing file
@param string $filename
@param string $appname
@return Renderer
@throws \Exception
344810
public function removeActivity(string $filename, string $appname)
    {
        Server::delete(FEnv::get("framework.root")."apps/$appname/Routing/$filename.merc", "file");
        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
1265527
public function removeActivity(string $servicename):Renderer
    {
        $removeservice = false;
        $file = JL::open(FEnv::get("framework.config.core.services.file"));
        foreach ($file as $one => $value) {
            if ($one == $servicename) {
                unset($file->$one);
                $removeservice  = true;
                break;
            }
        }

        if ($removeservice == false) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Service does not exist")));
        }

        $render = json_encode($file, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.config.core.services.file"), $render);

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
949945
public function removeWatermark($fileName)
    {
        //check whether files are set or not
        if ($fileName == '')
            throw new Exception('File not specified');

        //build URI to insert watermark image
        $strURI = Product::$baseProductUri . '/words/' . $fileName .
            '/watermark';

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'DELETE', '', '');

        $v_output = Utils::validateOutput($responseStream);

        if ($v_output === '') {
            //Save doc on server
            $folder = new Folder();
            $outputStream = $folder->GetFile($fileName);
            $outputPath = AsposeApp::$outPutLocation . $fileName;
            Utils::saveFile($outputStream, $outputPath);
            return $outputPath;
        } else
            return $v_output;
    }
317755
protected function loadRoutes(string $filename)
  {
    $filename = realpath($filename);

    if ( file_exists($filename) ) {
      $routesFile = json_decode( file_get_contents($filename), true );
      if ($routesFile) {
        $routeGroups = $routesFile['groups'] ?? [];
        # Add each RouteGroup
        foreach ($routeGroups as $routeGroupDef)
        {
          # Create new Route Group
          $routeGroup = new \Nofuzz\Route\Group($routeGroupDef);

          # Add to list
          $this->routeGroups[] = $routeGroup;
        }

        # Common Middlewares
        $this->beforeMiddleware = ($routesFile['common']['before'] ?? []);
        $this->afterMiddleware = ($routesFile['common']['after'] ?? []);
      } else {
        throw new \RunTimeException('Invalid JSON file "'.$filename.'"');

      }

      # Debug log
      $this->getLogger()->debug('Loaded routes',['file'=>$filename]);

      return true; // routes added
    }

    return false; // file not found
  }
93715
public function remove($fileName): bool
    {
        return unlink($this->fileInfo->getAbsoluteFilePath() . MDir::getSeparator() . $fileName);
    }
580627
public static function createHimSelf(string $appname):bool
    {
        if (false == JL::exists(FEnv::get("framework.root")."apps/".
            $appname."/config.json")) {
            $file = new \stdClass();
            $file->visibility_dev = null;
            $file->visibility_prod = null;
            $file->hosts_allowed_dev = null;
            $file->hosts_denied_dev = null;
            $file->hosts_allowed_prod = null;
            $file->hosts_denied_prod = null;
            $file->locale_enabled = false;
            $file->prefer_locale = null;
            $file->locale_values = null;
            $file->trans_type = null;

            JsonListener::put(
                FEnv::get("framework.root")."apps/". $appname."/config.json",
                json_encode($file, JSON_PRETTY_PRINT)
            );
            return (JL::exists(FEnv::get("framework.root")."apps/".
                $appname."/config.json"));
        }
        return (false);
    }
911122
protected function _deleteFile($filename) {
        $ini = Zend_Registry::get('config');
        $uploadPath = $ini->app->uploadsDirectory;
        $uploadPath = rtrim($uploadPath, '/\\').DIRECTORY_SEPARATOR;
        $filePath   = $uploadPath.$filename;
        if (file_exists($filePath) && is_file($filePath)) {
            unlink($filePath);
        }
    }
951922
protected function analyseMercure($file, string $filename, string $appname):int
    {
        $start = 0;
        $end = 0;
        while ($listen = trim(fgets($file, 1024))) {
            if ($listen == "route:" || $listen == "route :") {
                $start++;
            }
            if ($listen == "endroute") {
                $end++;
            }
        }
        if ($start != $end) {
            if ($start < $end) {
                throw new Server500(new \ArrayObject(array("explain" => "Missing tag 'route' in "
                    .$filename. " Routing file : ".$appname , "solution" => "Please check your Mercure file")));
            }
            if ($end < $start) {
                throw new Server500(new \ArrayObject(array("explain" => "Missing tag 'endroute' in "
                    .$filename. " Routing file : ".$appname, "solution" => "Please check your Mercure file")));
            }
            return (0);
        }
        return (1);
    }
861066
public function deleteFile($filename)
    {
        if (isset($this->_fileHandlers[$filename])) {
            $this->_fileHandlers[$filename]->close();
        }
        unset($this->_fileHandlers[$filename]);

        global $php_errormsg;
        $trackErrors = ini_get('track_errors'); ini_set('track_errors', '1');
        if (!@unlink($this->_dirPath . '/' . $filename)) {
            ini_set('track_errors', $trackErrors);
            include_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $php_errormsg);
        }
        ini_set('track_errors', $trackErrors);
    }
354270
public function DisableApplication($ApplicationName) {
      // 1. Check to make sure that this application is allowed to be disabled
      $ApplicationInfo = ArrayValueI($ApplicationName, $this->AvailableApplications(), array());
      $ApplicationName = $ApplicationInfo['Index'];
      if (!ArrayValue('AllowDisable', $ApplicationInfo, TRUE))
         throw new Exception(sprintf(T('You cannot disable the %s application.'), $ApplicationName));

      // 2. Check to make sure that no other enabled applications rely on this one
      foreach ($this->EnabledApplications() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = ArrayValue('RequiredApplications', $CheckingInfo, FALSE);
         if (is_array($RequiredApplications) && array_key_exists($ApplicationName, $RequiredApplications) === TRUE) {
            throw new Exception(sprintf(T('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $ApplicationName, $CheckingName));
         }
      }

      // 2. Disable it
      RemoveFromConfig("EnabledApplications.{$ApplicationName}");

      // Clear the object caches.
      Gdn_Autoloader::SmartFree(Gdn_Autoloader::CONTEXT_APPLICATION, $ApplicationInfo);

      // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
      $Locale = Gdn::Locale();
      $Locale->Set($Locale->Current(), $this->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE);
      
      $this->EventArguments['AddonName'] = $ApplicationName;
      Gdn::PluginManager()->CallEventHandlers($this, 'ApplicationManager', 'AddonDisabled');
   }
1010249
public static function remove(string $appName) : bool
    {
        if (self::exist($appName)) {
            if ($appName === self::$default) {
                throw new \RuntimeException(
                    sprintf('Can not remove default service : %s!', $appName),
                    E_WARNING
                );
            }

            unset(self::$serviceCollections[$appName]);
            $service = reset(self::$serviceCollections);
            if (!$service) {
                self::$serviceCollections = new \ArrayObject();
                return true;
            }

            self::setDefault($service);
            return true;
        }

        return false;
    }
860418
public function DeleteChacheFile($filename) {
    if (preg_match('/^\/CURL_RESPON-[0-9a-f]{40}\.\d+$/', $filename)) {
      $filename = $this->CacheDir . $filename;
      if (file_exists($filename)) {
        unlink($filename);
      }
    }
  }
255697
protected function resolve($filename, $scope)
    {
        $scopeIndex = ($scope === false)? '' : $scope;
        $theme = $this->getCurrentTheme();
        $url = false;

        if (isset($this->locations[$theme][$scopeIndex][$filename])) {
            return $this->locations[$theme][$scopeIndex][$filename];
        }

        if ($this->publishingStrategy) {
            $url = $this->publishingStrategy->find($filename, $scope, $this->getTheme());
        }

        if ($url === false) {
            if (!$this->router) {
                throw new exception\DependencyException('Missing router instance to build dynamic resource url');
            }

            $routeOptions = array(
                'name' => 'rampage.core.resources',
            );

            $routeParams = array(
                'theme' => $theme,
                'scope' => ($scope? : '__theme__'),
                'file' => $filename
            );

            $url = $this->router->assemble($routeParams, $routeOptions);

            if ($this->baseUrl) {
                $url = $this->baseUrl->getUrl($url);
            }
        }

        $this->locations[$theme][$scopeIndex][$filename] = $url;
        return $url;
    }
989793
protected function find($fileName)
    {
        $fileName = $fileName . '.' . $this->fileExtension;

        foreach ($this->viewPaths as $path) {
            if (file_exists($path . $fileName)) {
                return realpath($path . $fileName);
            }
        }

        throw new \Exception("View $fileName not found.");
    }
96731
public function remove($id, $filename = null)
    {
        if ($filename == null) {
            return FileManager::rmdir($this->getPath($id));
        } else {
            return FileManager::rmfile($this->getPath($id, $filename));
        }
    }
965309
private function checkIfKeyExist(array $resource, string $filename, string $appname):int
    {
        if (!isset($resource["activity"])) {
            throw new  Server500(new \ArrayObject(array("explain" => "Missing Tag 'activity' in ".
                strtoupper($filename)." routing file : ".$appname, "solution" => "Please add this tag")));
        }
        if (!isset($resource["name"])) {
            throw new  Server500(new \ArrayObject(array("explain" => "Missing Tag 'name' in ".
                strtoupper($filename)." routing file : ".$appname, "solution" => "Please add this tag")));
        }
        if (!isset($resource["path"])) {
            throw new  Server500(new \ArrayObject(array("explain" => "Missing Tag 'path' in ".
                strtoupper($filename)." routing file : ".$appname, "solution" => "Please add this tag")));
        }


        if ($resource["name"] == "") {
            throw new  Server500(new \ArrayObject(array("explain" => "Empty Tag 'name' in ".
                strtoupper($filename)." routing file : ".$appname, "solution" => "Check contain of this tag")));
        }
        if ($resource["activity"] == "") {
            throw new  Server500(new \ArrayObject(array("explain" => "Empty Tag 'activity' in ".
                strtoupper($filename)." routing file : ".$appname, "solution" => "Check contain of this tag")));
        }
        if ($resource["path"] == "") {
            throw new  Server500(new \ArrayObject(array("explain" => "Empty Tag 'path' in ".
                strtoupper($filename)." routing file : ".$appname, "solution" => "Check contain of this tag")));
        }

        if (isset($resource["visibility"]) && !in_array($resource["visibility"], $this->visibilities)) {
            throw new  Server500(new \ArrayObject(array("explain" =>
                "Tag 'visibility' is empty or parameter for 'visibility' is not recognized in ".
                strtoupper($filename)." routing file - ".$appname, "solution" =>
                "Check contain of this tag (Visibility must be private, public or disabled)")));
        }

        return (1);
    }
787356
public function load($filename)
    {
        if ($t = $this->tryLoad($filename)) {
            return $t;
        }

        throw new Exception([
            'Unable to read template from file',
            'cwd'  => getcwd(),
            'file' => $filename,
        ]);
    }