1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-26 02:55:02 +00:00

Move associated file when moving a page. Fixes #22.

This commit is contained in:
Starbeamrainbowlabs 2015-10-25 11:02:20 +00:00
parent b62e28db88
commit 7fbfb722ed
3 changed files with 19 additions and 1 deletions

View file

@ -2208,6 +2208,15 @@ register_module([
$pageindex->$new_name->$key = $value;
}
unset($pageindex->$page);
// If this page has an associated file, then we should move that too
if(isset($pageindex->$new_name->uploadedfile) and
$pageindex->$new_name->uploadedfile == true)
{
// Move the file in the pageindex
$pageindex->$new_name->uploadedfilepath = $new_name;
// Move the file on disk
rename($env->page, $new_name);
}
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
//move the page on the disk

View file

@ -131,7 +131,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds an action to allow administrators to move pages.",
"id": "page-move",
"lastupdate": 1445170746,
"lastupdate": 1445770790,
"optional": false
},
{

View file

@ -53,6 +53,15 @@ register_module([
$pageindex->$new_name->$key = $value;
}
unset($pageindex->$page);
// If this page has an associated file, then we should move that too
if(isset($pageindex->$new_name->uploadedfile) and
$pageindex->$new_name->uploadedfile == true)
{
// Move the file in the pageindex
$pageindex->$new_name->uploadedfilepath = $new_name;
// Move the file on disk
rename($env->page, $new_name);
}
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
//move the page on the disk