Admin_SettingsController::robotsTxtAction PHP Метод

robotsTxtAction() публичный Метод

public robotsTxtAction ( )
    public function robotsTxtAction()
    {
        $this->checkPermission("robots.txt");
        $siteSuffix = "";
        if ($this->getParam("site")) {
            $siteSuffix = "-" . $this->getParam("site");
        }
        $robotsPath = PIMCORE_CONFIGURATION_DIRECTORY . "/robots" . $siteSuffix . ".txt";
        if ($this->getParam("data") !== null) {
            // save data
            \Pimcore\File::put($robotsPath, $this->getParam("data"));
            $this->_helper->json(["success" => true]);
        } else {
            // get data
            $data = "";
            if (is_file($robotsPath)) {
                $data = file_get_contents($robotsPath);
            }
            $this->_helper->json(["success" => true, "data" => $data, "onFileSystem" => file_exists(PIMCORE_DOCUMENT_ROOT . "/robots.txt")]);
        }
    }