Skip to content

Commit

Permalink
ENH Remove references to non-existent installer tool
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jun 11, 2024
1 parent f9158a9 commit b2424a5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 131 deletions.
78 changes: 0 additions & 78 deletions code/Controllers/ContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class ContentController extends Controller
];

private static $allowed_actions = [
'successfullyinstalled',
'deleteinstallfiles', // secured through custom code
'LoginForm',
];

Expand Down Expand Up @@ -437,80 +435,4 @@ public function getViewer($action)
$templates = array_merge(...$templatesFound);
return SSViewer::create($templates);
}


/**
* This action is called by the installation system
*/
public function successfullyinstalled()
{
// Return 410 Gone if this site is not actually a fresh installation
if (!file_exists(PUBLIC_PATH . '/install.php')) {
$this->httpError(410);
}

if (isset($_SESSION['StatsID']) && $_SESSION['StatsID']) {
$url = 'http://ss2stat.silverstripe.com/Installation/installed?ID=' . $_SESSION['StatsID'];
@file_get_contents($url ?? '');
}

global $project;
$data = new ArrayData([
'Project' => Convert::raw2xml($project),
'Username' => Convert::raw2xml($this->getRequest()->getSession()->get('username')),
'Password' => Convert::raw2xml($this->getRequest()->getSession()->get('password')),
]);

return [
"Title" => _t(__CLASS__ . ".INSTALL_SUCCESS", "Installation Successful!"),
"Content" => $data->renderWith([
'type' => 'Includes',
'Install_successfullyinstalled',
]),
];
}

public function deleteinstallfiles()
{
if (!Permission::check("ADMIN")) {
return Security::permissionFailure($this);
}

$title = new DBVarchar("Title");
$content = new DBHTMLText('Content');

// As of SS4, index.php is required and should never be deleted.
$installfiles = [
'install.php',
'install-frameworkmissing.html',
'index.html'
];

$unsuccessful = new ArrayList();
foreach ($installfiles as $installfile) {
$installfilepath = PUBLIC_PATH . '/' . $installfile;
if (file_exists($installfilepath ?? '')) {
@unlink($installfilepath ?? '');
}

if (file_exists($installfilepath ?? '')) {
$unsuccessful->push(new ArrayData(['File' => $installfile]));
}
}

$data = new ArrayData([
'Username' => Convert::raw2xml($this->getRequest()->getSession()->get('username')),
'Password' => Convert::raw2xml($this->getRequest()->getSession()->get('password')),
'UnsuccessfulFiles' => $unsuccessful,
]);
$content->setValue($data->renderWith([
'type' => 'Includes',
'Install_deleteinstallfiles',
]));

return [
"Title" => $title,
"Content" => $content,
];
}
}
11 changes: 0 additions & 11 deletions code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2212,17 +2212,6 @@ public function getCMSFields()
);
}

if (file_exists(PUBLIC_PATH . '/install.php')) {
$fields->addFieldToTab('Root.Main', LiteralField::create(
'InstallWarningHeader',
'<div class="alert alert-warning">' . _t(
__CLASS__ . '.REMOVE_INSTALL_WARNING',
"Warning: You should remove install.php from this SilverStripe install for security reasons."
)
. '</div>'
), 'Title');
}

if (self::$runCMSFieldsExtensions) {
$this->extend('updateCMSFields', $fields);
}
Expand Down
21 changes: 0 additions & 21 deletions templates/Includes/Install_deleteinstallfiles.ss

This file was deleted.

21 changes: 0 additions & 21 deletions templates/Includes/Install_successfullyinstalled.ss

This file was deleted.

0 comments on commit b2424a5

Please sign in to comment.