Skip to content

Instantly share code, notes, and snippets.

@mssyogi
Created January 24, 2018 06:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mssyogi/75619f46e45952a659b1a724428a4d9c to your computer and use it in GitHub Desktop.
Magento2 - Run from admin
<?php
$r = $_REQUEST['r'];
$root = getcwd();
if ($r == "flushcache") {
$cl = "php ". $root."/../n98-magerun2.phar cache:flush";
$results = shell_exec($cl);
echo $results;
}
if($r == "reindex") {
$cl = "php ". $root."/../n98-magerun2.phar indexer:reindex";
$results = shell_exec($cl);
echo $results;
}
if($r == "reindexinfo") {
$cl1 = "php ". $root."/../n98-magerun2.phar indexer:info";
$results1 = shell_exec($cl1);
$cl2 = "php ". $root."/../n98-magerun2.phar indexer:status";
$results2 = shell_exec($cl2);
echo $results1;
echo "<hr>";
echo $results2;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment