Wipe a certain revision
Review Request #61 - Created Jan. 27, 2009 and submitted
Information | |
---|---|
Savin Tiberiu | |
infoarena | |
Reviewers | |
hackers | |
I added the 'delete a revision' feature.
Description: |
|
---|
Description: |
|
---|
Description: |
|
---|
Change Summary:
I added the 'delete a revision' feature. Available only for admins.
Diff: |
Revision 2 (+35 -5) |
---|
Description: |
|
---|
Description: |
|
---|
-
/trunk/common/db/textblock.php (Diff revision 3) -
Use 4 spaces for tab
-
/trunk/www/controllers/textblock.php (Diff revision 3) -
Extra whitespace. You need to check if request is POST, so a admin can't be tricked into clicking a link infoarena.ro/home?action=delete-revision&revision=blahblah. Look at other controllers to see how. Also use identity_require to check if user can delete the revision. Something like: identity_require("textblock-delete-revision", $revision)
-
/trunk/www/controllers/textblock.php (Diff revision 3) -
Check if page exists?
-
/trunk/www/views/textblock_history.php (Diff revision 3) -
Extra whitespace.
-
/trunk/www/views/textblock_history.php (Diff revision 3) -
I'm not sure it's a good idea to get every revision since there can be up to 200 revisions on a page. Better just display the link to everybody. The check should be done in the controller anyway.
-
/trunk/www/views/textblock_history.php (Diff revision 3) -
Use format_post_link like with restore.
Change Summary:
done everything bogdan said. Hope I didn't forget anything.
Diff: |
Revision 4 (+45 -3) |
---|
Change Summary:
New features added. Now the current can be deleted and will be replaced by the next revision available. If there is no next revision the whole textblock is deleted. Also I added a "Sterge" link on view/revision_warning.php.
Diff: |
Revision 5 (+96 -6) |
---|
We're getting close.
-
/trunk/common/db/textblock.php (Diff revisions 4 - 5) -
"LIMIT 1", else you'll query for all revisions.
-
/trunk/common/db/textblock.php (Diff revisions 4 - 5) -
It's easier to do something like REPLACE INTO `ia_textblock` ( SELECT * FROM `ia_textblock_revision` WHERE `name` = "blahblah" ORDER BY `timestamp` DESC" LIMIT 1 ); It works since ia_textblock and ia_textblock_revision have the same columns in the same order :)
-
/trunk/www/controllers/textblock.php (Diff revisions 4 - 5) -
I don't think it's a good idea to pass number of revisions as a parameter, since that number can change from when you displayed the link to someone and when it was clicked. I'm pretty sure there is a function which counts the number of revisions (textblock_get_revision_count I think and counting is fast in the database).
-
/trunk/www/views/revision_warning.php (Diff revision 5) -
Here you can use identity_can since you already have the revision and don't have to get it from the db like with textblock history.