mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
Move associated file when moving a page. Fixes #22.
This commit is contained in:
parent
b62e28db88
commit
7fbfb722ed
3 changed files with 19 additions and 1 deletions
|
@ -2208,6 +2208,15 @@ register_module([
|
||||||
$pageindex->$new_name->$key = $value;
|
$pageindex->$new_name->$key = $value;
|
||||||
}
|
}
|
||||||
unset($pageindex->$page);
|
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));
|
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
//move the page on the disk
|
//move the page on the disk
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds an action to allow administrators to move pages.",
|
"description": "Adds an action to allow administrators to move pages.",
|
||||||
"id": "page-move",
|
"id": "page-move",
|
||||||
"lastupdate": 1445170746,
|
"lastupdate": 1445770790,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,15 @@ register_module([
|
||||||
$pageindex->$new_name->$key = $value;
|
$pageindex->$new_name->$key = $value;
|
||||||
}
|
}
|
||||||
unset($pageindex->$page);
|
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));
|
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
//move the page on the disk
|
//move the page on the disk
|
||||||
|
|
Loading…
Reference in a new issue