From a5eb5e3e80da0200bd70a503ecf3697bec542dde Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 22 Jun 2009 13:25:46 -0700 Subject: Updated --- modules/gallery/tests/xss_data.txt | 238 ++++++++++++++++++------------------- 1 file changed, 113 insertions(+), 125 deletions(-) (limited to 'modules/gallery/tests') diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index f47ae0dc..6133b025 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -37,9 +37,26 @@ modules/comment/views/admin_comments.html.php 194 DIRTY $pager modules/comment/views/comment.html.php 2 DIRTY $comment->id modules/comment/views/comment.html.php 5 DIRTY $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) modules/comment/views/comment.html.php 7 $comment->author_name() -modules/comment/views/comment.html.php 11 DIRTY $comment->created -modules/comment/views/comment.html.php 12 $comment->author_name() -modules/comment/views/comment.html.php 15 $comment->text +modules/comment/views/comment.html.php 12 DIRTY $comment->created +modules/comment/views/comment.html.php 13 $comment->author_name() +modules/comment/views/comment.html.php 16 $comment->text +modules/comment/views/comment.mrss.php 9 $feed->title +modules/comment/views/comment.mrss.php 10 DIRTY $feed->uri +modules/comment/views/comment.mrss.php 11 $feed->description +modules/comment/views/comment.mrss.php 13 DIRTY $feed->uri +modules/comment/views/comment.mrss.php 16 DIRTY $feed->previous_page_uri +modules/comment/views/comment.mrss.php 19 DIRTY $feed->next_page_uri +modules/comment/views/comment.mrss.php 21 DIRTY $pub_date +modules/comment/views/comment.mrss.php 22 DIRTY $pub_date +modules/comment/views/comment.mrss.php 25 $child->title +modules/comment/views/comment.mrss.php 26 $child->item_uri +modules/comment/views/comment.mrss.php 27 $child->author +modules/comment/views/comment.mrss.php 28 DIRTY $child->item_uri +modules/comment/views/comment.mrss.php 29 DIRTY $child->pub_date +modules/comment/views/comment.mrss.php 32 $child->text +modules/comment/views/comment.mrss.php 34 DIRTY $child->thumb_url +modules/comment/views/comment.mrss.php 35 DIRTY $child->thumb_height +modules/comment/views/comment.mrss.php 35 DIRTY $child->thumb_width modules/comment/views/comments.html.php 10 DIRTY $comment->id modules/comment/views/comments.html.php 13 DIRTY $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) modules/comment/views/comments.html.php 15 $comment->author_name() @@ -55,18 +72,19 @@ modules/exif/views/exif_dialog.html.php 21 DIRTY $i modules/exif/views/exif_dialog.html.php 24 $details modules/exif/views/exif_dialog.html.php 24 $i modules/exif/views/exif_sidebar.html.php 2 DIRTY $item->id -modules/g2_import/views/admin_g2_import.html.php 8 DIRTY $form -modules/g2_import/views/admin_g2_import.html.php 26 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 29 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 32 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 35 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 38 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 41 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 45 DIRTY $g2_stats -modules/g2_import/views/admin_g2_import.html.php 53 DIRTY $g2_sizes -modules/g2_import/views/admin_g2_import.html.php 54 DIRTY $thumb_size -modules/g2_import/views/admin_g2_import.html.php 62 DIRTY $g2_sizes -modules/g2_import/views/admin_g2_import.html.php 63 DIRTY $resize_size +modules/g2_import/views/admin_g2_import.html.php 28 DIRTY $form +modules/g2_import/views/admin_g2_import.html.php 40 DIRTY $g2_sizes +modules/g2_import/views/admin_g2_import.html.php 41 DIRTY $thumb_size +modules/g2_import/views/admin_g2_import.html.php 49 DIRTY $g2_sizes +modules/g2_import/views/admin_g2_import.html.php 50 DIRTY $resize_size +modules/g2_import/views/admin_g2_import.html.php 62 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 65 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 68 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 71 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 74 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 77 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 81 DIRTY $g2_stats +modules/g2_import/views/admin_g2_import.html.php 88 DIRTY $csrf modules/gallery/views/admin_advanced_settings.html.php 22 DIRTY $var->module_name modules/gallery/views/admin_advanced_settings.html.php 23 $var->name modules/gallery/views/admin_advanced_settings.html.php 25 DIRTY $var->module_name @@ -140,13 +158,14 @@ modules/gallery/views/admin_maintenance.html.php 171 DIRTY $task->id modules/gallery/views/admin_maintenance.html.php 171 DIRTY $csrf modules/gallery/views/admin_maintenance_task.html.php 5 DIRTY $task->id modules/gallery/views/admin_maintenance_task.html.php 5 DIRTY $csrf +modules/gallery/views/admin_maintenance_task.html.php 26 DIRTY $task->name modules/gallery/views/admin_modules.html.php 19 DIRTY $i modules/gallery/views/admin_modules.html.php 22 DIRTY $data modules/gallery/views/admin_modules.html.php 22 DIRTY $module_name modules/gallery/views/admin_modules.html.php 23 DIRTY $module_info->name modules/gallery/views/admin_modules.html.php 24 DIRTY $module_info->version modules/gallery/views/admin_modules.html.php 25 DIRTY $module_info->description -modules/gallery/views/admin_theme_details.html.php 5 DIRTY $form +modules/gallery/views/admin_theme_options.html.php 5 DIRTY $form modules/gallery/views/admin_themes.html.php 5 DIRTY $csrf modules/gallery/views/admin_themes.html.php 18 DIRTY $site modules/gallery/views/admin_themes.html.php 19 DIRTY $themes @@ -187,13 +206,13 @@ modules/gallery/views/kohana_error_page.php 100 DIRTY $line modules/gallery/views/kohana_error_page.php 112 DIRTY $trace modules/gallery/views/kohana_profiler.php 32 DIRTY $profile->render() modules/gallery/views/kohana_profiler.php 34 DIRTY $execution_time -modules/gallery/views/l10n_client.html.php 13 DIRTY $string -modules/gallery/views/l10n_client.html.php 15 DIRTY $string -modules/gallery/views/l10n_client.html.php 16 DIRTY $string -modules/gallery/views/l10n_client.html.php 18 DIRTY $string -modules/gallery/views/l10n_client.html.php 24 DIRTY $l10n_search_form -modules/gallery/views/l10n_client.html.php 65 DIRTY $string_list -modules/gallery/views/l10n_client.html.php 66 DIRTY $plural_forms +modules/gallery/views/l10n_client.html.php 17 DIRTY $string +modules/gallery/views/l10n_client.html.php 19 DIRTY $string +modules/gallery/views/l10n_client.html.php 20 DIRTY $string +modules/gallery/views/l10n_client.html.php 22 DIRTY $string +modules/gallery/views/l10n_client.html.php 28 DIRTY $l10n_search_form +modules/gallery/views/l10n_client.html.php 70 DIRTY $string_list +modules/gallery/views/l10n_client.html.php 71 DIRTY $plural_forms modules/gallery/views/move_browse.html.php 4 DIRTY $source->id modules/gallery/views/move_browse.html.php 39 DIRTY $tree modules/gallery/views/move_browse.html.php 42 DIRTY $source->id @@ -244,48 +263,29 @@ modules/gallery/views/permissions_form.html.php 74 DIRTY $item->id modules/gallery/views/permissions_form.html.php 79 DIRTY $group->id modules/gallery/views/permissions_form.html.php 79 DIRTY $permission->id modules/gallery/views/permissions_form.html.php 79 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 9 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 9 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 10 DIRTY $title -modules/gallery/views/quick_pane.html.php 12 DIRTY $title -modules/gallery/views/quick_pane.html.php 17 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 17 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 17 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 24 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 24 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 24 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 41 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 42 DIRTY $title -modules/gallery/views/quick_pane.html.php 44 DIRTY $title -modules/gallery/views/quick_pane.html.php 61 DIRTY $disabledState -modules/gallery/views/quick_pane.html.php 61 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 61 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 61 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 62 DIRTY $title -modules/gallery/views/quick_pane.html.php 64 DIRTY $title -modules/gallery/views/quick_pane.html.php 78 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 78 DIRTY $csrf -modules/gallery/views/quick_pane.html.php 78 DIRTY $page_type -modules/gallery/views/quick_pane.html.php 78 DIRTY $message -modules/gallery/views/quick_pane.html.php 78 DIRTY $title -modules/gallery/views/quick_pane.html.php 80 DIRTY $title -modules/gallery/views/quick_pane.html.php 93 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 98 DIRTY $item->id -modules/gallery/views/quick_pane.html.php 103 DIRTY $item->id +modules/gallery/views/quick_pane.html.php 3 DIRTY $button->class +modules/gallery/views/quick_pane.html.php 3 DIRTY $button->href +modules/gallery/views/quick_pane.html.php 4 DIRTY $button->title +modules/gallery/views/quick_pane.html.php 5 DIRTY $button->icon +modules/gallery/views/quick_pane.html.php 6 DIRTY $button->title +modules/gallery/views/quick_pane.html.php 20 DIRTY $button->class +modules/gallery/views/quick_pane.html.php 20 DIRTY $button->href +modules/gallery/views/quick_pane.html.php 21 DIRTY $button->title +modules/gallery/views/quick_pane.html.php 22 DIRTY $button->title modules/gallery/views/simple_uploader.html.php 6 DIRTY $csrf modules/gallery/views/simple_uploader.html.php 8 $item->title modules/gallery/views/simple_uploader.html.php 28 $parent->title modules/gallery/views/simple_uploader.html.php 30 $item->title modules/gallery/views/simple_uploader.html.php 77 DIRTY $item->id modules/gallery/views/simple_uploader.html.php 81 DIRTY $csrf -modules/gallery/views/upgrader.html.php 94 DIRTY $done -modules/gallery/views/upgrader.html.php 124 DIRTY $module->version -modules/gallery/views/upgrader.html.php 124 DIRTY $module->code_version -modules/gallery/views/upgrader.html.php 125 DIRTY $id -modules/gallery/views/upgrader.html.php 126 DIRTY $module->name -modules/gallery/views/upgrader.html.php 129 DIRTY $module->version -modules/gallery/views/upgrader.html.php 132 DIRTY $module->code_version -modules/gallery/views/upgrader.html.php 155 DIRTY $module->name +modules/gallery/views/upgrader.html.php 43 DIRTY $module->version +modules/gallery/views/upgrader.html.php 43 DIRTY $module->code_version +modules/gallery/views/upgrader.html.php 44 DIRTY $id +modules/gallery/views/upgrader.html.php 45 DIRTY $module->name +modules/gallery/views/upgrader.html.php 48 DIRTY $module->version +modules/gallery/views/upgrader.html.php 51 DIRTY $module->code_version +modules/gallery/views/upgrader.html.php 74 DIRTY $module->name +modules/gallery/views/upgrader.html.php 83 DIRTY $upgrade_token modules/image_block/views/image_block_block.html.php 3 DIRTY $item->url() modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class" => "gThumbnail")) modules/info/views/info_block.html.php 6 $item->title @@ -354,29 +354,12 @@ modules/recaptcha/views/admin_recaptcha.html.php 6 DIRTY $form->ge modules/recaptcha/views/admin_recaptcha.html.php 10 DIRTY $form modules/recaptcha/views/admin_recaptcha.html.php 23 DIRTY $public_key modules/recaptcha/views/form_recaptcha.html.php 7 DIRTY $public_key -modules/rss/views/comment.mrss.php 9 $title -modules/rss/views/comment.mrss.php 10 DIRTY $link -modules/rss/views/comment.mrss.php 11 $description -modules/rss/views/comment.mrss.php 13 DIRTY $feed_link -modules/rss/views/comment.mrss.php 16 DIRTY $previous_page_link -modules/rss/views/comment.mrss.php 19 DIRTY $next_page_link -modules/rss/views/comment.mrss.php 21 DIRTY $pub_date -modules/rss/views/comment.mrss.php 22 DIRTY $pub_date -modules/rss/views/comment.mrss.php 25 $child -modules/rss/views/comment.mrss.php 26 $child -modules/rss/views/comment.mrss.php 27 $child -modules/rss/views/comment.mrss.php 28 DIRTY $child -modules/rss/views/comment.mrss.php 29 DIRTY $child -modules/rss/views/comment.mrss.php 32 $child -modules/rss/views/comment.mrss.php 34 DIRTY $child -modules/rss/views/comment.mrss.php 35 DIRTY $child -modules/rss/views/comment.mrss.php 35 DIRTY $child -modules/rss/views/feed.mrss.php 9 $title -modules/rss/views/feed.mrss.php 10 DIRTY $link -modules/rss/views/feed.mrss.php 11 $description -modules/rss/views/feed.mrss.php 13 DIRTY $feed_link -modules/rss/views/feed.mrss.php 16 DIRTY $previous_page_link -modules/rss/views/feed.mrss.php 19 DIRTY $next_page_link +modules/rss/views/feed.mrss.php 9 $feed->title +modules/rss/views/feed.mrss.php 10 DIRTY $feed->uri +modules/rss/views/feed.mrss.php 11 $feed->description +modules/rss/views/feed.mrss.php 13 DIRTY $feed->uri +modules/rss/views/feed.mrss.php 16 DIRTY $feed->previous_page_uri +modules/rss/views/feed.mrss.php 19 DIRTY $feed->next_page_uri modules/rss/views/feed.mrss.php 21 DIRTY $pub_date modules/rss/views/feed.mrss.php 22 DIRTY $pub_date modules/rss/views/feed.mrss.php 25 $child->title @@ -519,14 +502,14 @@ themes/admin_default/views/block.html.php 5 DIRTY $id themes/admin_default/views/block.html.php 5 DIRTY $csrf themes/admin_default/views/block.html.php 10 DIRTY $title themes/admin_default/views/block.html.php 13 DIRTY $content -themes/admin_default/views/pager.html.php 9 DIRTY $from_to_msg themes/admin_default/views/pager.html.php 11 DIRTY $url -themes/admin_default/views/pager.html.php 16 DIRTY $previous_page -themes/admin_default/views/pager.html.php 16 DIRTY $url -themes/admin_default/views/pager.html.php 21 DIRTY $next_page -themes/admin_default/views/pager.html.php 21 DIRTY $url -themes/admin_default/views/pager.html.php 26 DIRTY $last_page -themes/admin_default/views/pager.html.php 26 DIRTY $url +themes/admin_default/views/pager.html.php 18 DIRTY $previous_page +themes/admin_default/views/pager.html.php 18 DIRTY $url +themes/admin_default/views/pager.html.php 25 DIRTY $from_to_msg +themes/admin_default/views/pager.html.php 28 DIRTY $next_page +themes/admin_default/views/pager.html.php 28 DIRTY $url +themes/admin_default/views/pager.html.php 35 DIRTY $last_page +themes/admin_default/views/pager.html.php 35 DIRTY $url themes/default/views/album.html.php 4 DIRTY $theme->album_top() themes/default/views/album.html.php 5 $item->title themes/default/views/album.html.php 6 $item->description @@ -584,29 +567,29 @@ themes/default/views/movie.html.php 18 DIRTY $item->he themes/default/views/movie.html.php 21 DIRTY $item->id themes/default/views/movie.html.php 35 $item->title themes/default/views/movie.html.php 36 $item->description -themes/default/views/movie.html.php 39 DIRTY $theme->photo_bottom() -themes/default/views/page.html.php 11 $item->title -themes/default/views/page.html.php 14 DIRTY $page_title -themes/default/views/page.html.php 16 DIRTY $theme->page_type -themes/default/views/page.html.php 18 DIRTY $theme->url("images/favicon.ico") -themes/default/views/page.html.php 25 DIRTY $theme->url("css/screen.css") -themes/default/views/page.html.php 28 DIRTY $theme->url("css/fix-ie.css") -themes/default/views/page.html.php 37 DIRTY $new_width -themes/default/views/page.html.php 38 DIRTY $new_height -themes/default/views/page.html.php 39 DIRTY $thumb_proportion -themes/default/views/page.html.php 51 DIRTY $theme->url("js/jquery.scrollTo.js") -themes/default/views/page.html.php 52 DIRTY $theme->url("js/jquery.localscroll.js") -themes/default/views/page.html.php 53 DIRTY $theme->url("js/ui.init.js") -themes/default/views/page.html.php 54 DIRTY $theme->head() -themes/default/views/page.html.php 57 DIRTY $theme->body_attributes() -themes/default/views/page.html.php 58 DIRTY $theme->page_top() -themes/default/views/page.html.php 60 DIRTY $theme->site_status() -themes/default/views/page.html.php 62 DIRTY $theme->display("header.html") -themes/default/views/page.html.php 68 DIRTY $theme->messages() -themes/default/views/page.html.php 69 DIRTY $content -themes/default/views/page.html.php 74 DIRTY $theme->display("sidebar.html") -themes/default/views/page.html.php 78 DIRTY $theme->display("footer.html") -themes/default/views/page.html.php 81 DIRTY $theme->page_bottom() +themes/default/views/movie.html.php 42 DIRTY $theme->photo_bottom() +themes/default/views/page.html.php 9 DIRTY $page_title +themes/default/views/page.html.php 13 $theme->item()->title +themes/default/views/page.html.php 15 $theme->item()->title +themes/default/views/page.html.php 17 $theme->item()->title +themes/default/views/page.html.php 20 $theme->tag()->name +themes/default/views/page.html.php 26 DIRTY $theme->url("images/favicon.ico") +themes/default/views/page.html.php 33 DIRTY $theme->url("css/screen.css") +themes/default/views/page.html.php 36 DIRTY $theme->url("css/fix-ie.css") +themes/default/views/page.html.php 45 DIRTY $new_width +themes/default/views/page.html.php 46 DIRTY $new_height +themes/default/views/page.html.php 47 DIRTY $thumb_proportion +themes/default/views/page.html.php 63 DIRTY $theme->url("js/ui.init.js") +themes/default/views/page.html.php 64 DIRTY $theme->head() +themes/default/views/page.html.php 67 DIRTY $theme->body_attributes() +themes/default/views/page.html.php 68 DIRTY $theme->page_top() +themes/default/views/page.html.php 70 DIRTY $theme->site_status() +themes/default/views/page.html.php 72 DIRTY $theme->display("header.html") +themes/default/views/page.html.php 78 DIRTY $theme->messages() +themes/default/views/page.html.php 79 DIRTY $content +themes/default/views/page.html.php 85 DIRTY $theme->display("sidebar.html") +themes/default/views/page.html.php 90 DIRTY $theme->display("footer.html") +themes/default/views/page.html.php 93 DIRTY $theme->page_bottom() themes/default/views/pager.html.php 11 DIRTY $url themes/default/views/pager.html.php 18 DIRTY $previous_page themes/default/views/pager.html.php 18 DIRTY $url @@ -615,19 +598,24 @@ themes/default/views/pager.html.php 28 DIRTY $next_pag themes/default/views/pager.html.php 28 DIRTY $url themes/default/views/pager.html.php 35 DIRTY $last_page themes/default/views/pager.html.php 35 DIRTY $url -themes/default/views/photo.html.php 3 DIRTY $theme->photo_top() -themes/default/views/photo.html.php 8 DIRTY $previous_item->url() -themes/default/views/photo.html.php 15 DIRTY $position -themes/default/views/photo.html.php 15 DIRTY $sibling_count -themes/default/views/photo.html.php 18 DIRTY $next_item->url() -themes/default/views/photo.html.php 28 DIRTY $theme->resize_top($item) -themes/default/views/photo.html.php 32 DIRTY $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) -themes/default/views/photo.html.php 36 DIRTY $theme->resize_bottom($item) -themes/default/views/photo.html.php 40 $item->title -themes/default/views/photo.html.php 41 $item->description -themes/default/views/photo.html.php 47 DIRTY $theme->photo_bottom() +themes/default/views/photo.html.php 9 DIRTY $theme->item()->file_url() +themes/default/views/photo.html.php 9 DIRTY $theme->item()->width +themes/default/views/photo.html.php 9 DIRTY $theme->item()->height +themes/default/views/photo.html.php 17 DIRTY $theme->photo_top() +themes/default/views/photo.html.php 22 DIRTY $previous_item->url() +themes/default/views/photo.html.php 29 DIRTY $position +themes/default/views/photo.html.php 29 DIRTY $sibling_count +themes/default/views/photo.html.php 32 DIRTY $next_item->url() +themes/default/views/photo.html.php 42 DIRTY $theme->resize_top($item) +themes/default/views/photo.html.php 44 DIRTY $item->file_url() +themes/default/views/photo.html.php 46 DIRTY $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) +themes/default/views/photo.html.php 50 DIRTY $theme->resize_bottom($item) +themes/default/views/photo.html.php 54 $item->title +themes/default/views/photo.html.php 55 $item->description +themes/default/views/photo.html.php 61 DIRTY $theme->photo_bottom() themes/default/views/sidebar.html.php 2 DIRTY $theme->sidebar_top() themes/default/views/sidebar.html.php 6 DIRTY $theme->album_menu() themes/default/views/sidebar.html.php 8 DIRTY $theme->photo_menu() -themes/default/views/sidebar.html.php 13 DIRTY $theme->sidebar_blocks() -themes/default/views/sidebar.html.php 14 DIRTY $theme->sidebar_bottom() +themes/default/views/sidebar.html.php 10 DIRTY $theme->tag_menu() +themes/default/views/sidebar.html.php 15 DIRTY $theme->sidebar_blocks() +themes/default/views/sidebar.html.php 16 DIRTY $theme->sidebar_bottom() -- cgit v1.2.3 From d8fe96d70b938b6d7f226fdd6564b25877558a04 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 22 Jun 2009 13:48:19 -0700 Subject: Update version comparison to match latest gallery module version --- modules/gallery/tests/Gallery_Installer_Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/tests') diff --git a/modules/gallery/tests/Gallery_Installer_Test.php b/modules/gallery/tests/Gallery_Installer_Test.php index 24d24b38..001b7d26 100644 --- a/modules/gallery/tests/Gallery_Installer_Test.php +++ b/modules/gallery/tests/Gallery_Installer_Test.php @@ -33,7 +33,7 @@ class Gallery_Installer_Test extends Unit_Test_Case { $this->assert_equal("gallery", $gallery->name); // This is probably too volatile to keep for long - $this->assert_equal(1, $gallery->version); + $this->assert_equal(2, $gallery->version); } public function install_creates_root_item_test() { -- cgit v1.2.3 From 52ecdcdff2ffd37760c0d0edbe7cd2fcc62a47fc Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 27 Jun 2009 23:24:23 -0700 Subject: Implemented a Database driver for the Kohana Cache library. Rather then writing our own caching algorithm, we can leverage the Kohana library. This has the added advantage of allowing the administrator to replace the default caching with a 3rd party caching algorithm. --- modules/gallery/models/cache.php | 20 ++++ modules/gallery/tests/Cache_Test.php | 178 +++++++++++++++++++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 modules/gallery/models/cache.php create mode 100644 modules/gallery/tests/Cache_Test.php (limited to 'modules/gallery/tests') diff --git a/modules/gallery/models/cache.php b/modules/gallery/models/cache.php new file mode 100644 index 00000000..99e19a6e --- /dev/null +++ b/modules/gallery/models/cache.php @@ -0,0 +1,20 @@ +from("caches")->where(1)->delete(); + $this->_driver = new Cache_Database_Driver(); + } + + public function cache_exists_test() { + $db = Database::instance(); + + $this->assert_false($this->_driver->exists("test_key"), "test_key should not be defined"); + + $id = md5(rand()); + $db->insert("caches", array("id" => $id, "tags" => ", ", + "expiration" => 84600 + time(), + "cache" => serialize("some test data"))); + + $this->assert_true($this->_driver->exists($id), "test_key should be defined"); + } + + public function cache_get_test() { + $db = Database::instance(); + + $id = md5(rand()); + $db->insert("caches", array("id" => $id, "tags" => ", ", + "expiration" => 84600 + time(), + "cache" => serialize("some test data"))); + + $data = $this->_driver->get($id); + $this->assert_equal("some test data", $data, "cached data should match"); + + $data = $this->_driver->get(""); + $this->assert_equal(null, $data, "cached data should not be found"); + } + + public function cache_set_test() { + $db = Database::instance(); + + $id = md5(rand()); + $original_data = array("field1" => "value1", "field2" => "value2"); + $this->_driver->set($id, $original_data, array("tag1", "tag2"), 84600); + + $data = $this->_driver->get($id); + $this->assert_equal($original_data, $data, "cached data should match"); + } + + public function cache_find_test() { + $db = Database::instance(); + + $id1 = md5(rand()); + $value1 = array("field1" => "value1", "field2" => "value2"); + $this->_driver->set($id1, $value1, array("tag1", "tag2"), 84600); + + $id2 = md5(rand()); + $value2 = array("field3" => "value3", "field4" => "value4"); + $this->_driver->set($id2, $value2, array("tag2", "tag3"), 84600); + + $id3 = md5(rand()); + $value3 = array("field5" => "value5", "field6" => "value6"); + $this->_driver->set($id3, $value3, array("tag3", "tag4"), 84600); + + $data = $this->_driver->find("tag2"); + + $expected = array($id1 => $value1, $id2 => $value2); + ksort($expected); + $this->assert_equal($expected, $data, "Expected id1 & id2"); + + $data = $this->_driver->find("tag4"); + $this->assert_equal(array($id3 => $value3), $data, "Expected id3"); + } + + public function cache_delete_expired_test() { + $db = Database::instance(); + + $id1 = md5(rand()); + $value1 = array("field1" => "value1", "field2" => "value2"); + $this->_driver->set($id1, $value1, array("tag1", "tag2"), -84600); + + $id2 = md5(rand()); + $value2 = array("field3" => "value3", "field4" => "value4"); + $this->_driver->set($id2, $value2, array("tag2", "tag3"), -846000); + + $id3 = md5(rand()); + $value3 = array("field5" => "value5", "field6" => "value6"); + $this->_driver->set($id3, $value3, array("tag3", "tag4"), -84600); + + $data = $this->_driver->delete_expired(); + + $this->assert_false($this->_driver->exists($id1), "$id1 should have been deleted"); + $this->assert_false($this->_driver->exists($id2), "$id2 should have been deleted"); + $this->assert_false($this->_driver->exists($id3), "$id3 should have been deleted"); + } + + public function cache_delete_id_test() { + $db = Database::instance(); + + $id1 = md5(rand()); + $value1 = array("field1" => "value1", "field2" => "value2"); + $this->_driver->set($id1, $value1, array("tag1", "tag2"), 84600); + + $id2 = md5(rand()); + $value2 = array("field3" => "value3", "field4" => "value4"); + $this->_driver->set($id2, $value2, array("tag2", "tag3"), 846000); + + $id3 = md5(rand()); + $value3 = array("field5" => "value5", "field6" => "value6"); + $this->_driver->set($id3, $value3, array("tag3", "tag4"), 84600); + + $this->_driver->delete($id1); + + $this->assert_false($this->_driver->exists($id1), "$id1 should have been deleted"); + $this->assert_true($this->_driver->exists($id2), "$id2 should not have been deleted"); + $this->assert_true($this->_driver->exists($id3), "$id3 should not have been deleted"); + } + + public function cache_delete_tag_test() { + $db = Database::instance(); + + $id1 = md5(rand()); + $value1 = array("field1" => "value1", "field2" => "value2"); + $this->_driver->set($id1, $value1, array("tag1", "tag2"), 84600); + + $id2 = md5(rand()); + $value2 = array("field3" => "value3", "field4" => "value4"); + $this->_driver->set($id2, $value2, array("tag2", "tag3"), 846000); + + $id3 = md5(rand()); + $value3 = array("field5" => "value5", "field6" => "value6"); + $this->_driver->set($id3, $value3, array("tag3", "tag4"), 84600); + + $data = $this->_driver->delete("tag3", true); + + $this->assert_true($this->_driver->exists($id1), "$id1 should not have been deleted"); + $this->assert_false($this->_driver->exists($id2), "$id2 should have been deleted"); + $this->assert_false($this->_driver->exists($id3), "$id3 should have been deleted"); + } + + public function cache_delete_all_test() { + $db = Database::instance(); + + $id1 = md5(rand()); + $value1 = array("field1" => "value1", "field2" => "value2"); + $this->_driver->set($id1, $value1, array("tag1", "tag2"), 84600); + + $id2 = md5(rand()); + $value2 = array("field3" => "value3", "field4" => "value4"); + $this->_driver->set($id2, $value2, array("tag2", "tag3"), 846000); + + $id3 = md5(rand()); + $value3 = array("field5" => "value5", "field6" => "value6"); + $this->_driver->set($id3, $value3, array("tag3", "tag4"), 84600); + + $data = $this->_driver->delete(true); + + $this->assert_false($this->_driver->exists($id1), "$id1 should have been deleted"); + $this->assert_false($this->_driver->exists($id2), "$id2 should have been deleted"); + $this->assert_false($this->_driver->exists($id3), "$id3 should have been deleted"); + } +} \ No newline at end of file -- cgit v1.2.3 From a0c07d4b549f10dcd954777ae7d846a9b81246d8 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 28 Jun 2009 07:49:35 -0700 Subject: Clean up code (i.e. preamble, tabs) from the caching implementation so the unit tests pass --- modules/gallery/config/cache.php | 31 +++++++++++++++++----- .../gallery/libraries/drivers/Cache/Database.php | 12 ++++----- modules/gallery/tests/Gallery_Installer_Test.php | 3 --- 3 files changed, 30 insertions(+), 16 deletions(-) (limited to 'modules/gallery/tests') diff --git a/modules/gallery/config/cache.php b/modules/gallery/config/cache.php index 5f2cd6de..cc3ac87d 100644 --- a/modules/gallery/config/cache.php +++ b/modules/gallery/config/cache.php @@ -1,5 +1,23 @@ - 'database', - 'params' => null, - 'lifetime' => 84600, - 'requests' => 1000 +$config["default"] = array ( + "driver" => "database", + "params" => null, + "lifetime" => 84600, + "requests" => 1000 ); diff --git a/modules/gallery/libraries/drivers/Cache/Database.php b/modules/gallery/libraries/drivers/Cache/Database.php index e008f473..70235e05 100644 --- a/modules/gallery/libraries/drivers/Cache/Database.php +++ b/modules/gallery/libraries/drivers/Cache/Database.php @@ -1,4 +1,4 @@ -db = Database::instance(); if (!$this->db->table_exists("caches")) { - throw new Kohana_Exception('cache.driver_error', "Cache table is not defined"); + throw new Kohana_Exception("cache.driver_error", "Cache table is not defined"); } - Kohana::log('debug', 'Cache Database Driver Initialized'); + Kohana::log("debug", "Cache Database Driver Initialized"); } /** @@ -44,7 +44,7 @@ class Cache_Database_Driver implements Cache_Driver { * @return boolean */ public function exists($id) { - $count = $this->db->count_records("caches", array('id' => $id, "expiration >=" => time())); + $count = $this->db->count_records("caches", array("id" => $id, "expiration >=" => time())); return $count > 0; } @@ -60,7 +60,7 @@ class Cache_Database_Driver implements Cache_Driver { public function set($id, $data, array $tags = NULL, $lifetime) { if (!empty($tags)) { // Escape the tags, adding brackets so the tag can be explicitly matched - $tags = '<' . implode('>,<', $tags) . '>'; + $tags = "<" . implode(">,<", $tags) . ">"; } // Cache Database driver expects unix timestamp @@ -120,7 +120,7 @@ class Cache_Database_Driver implements Cache_Driver { */ public function get($id) { $data = null; - $result = $this->db->getwhere("caches", array('id' => $id)); + $result = $this->db->getwhere("caches", array("id" => $id)); if (count($result) > 0) { $cache = $result->current(); diff --git a/modules/gallery/tests/Gallery_Installer_Test.php b/modules/gallery/tests/Gallery_Installer_Test.php index 001b7d26..27157d6e 100644 --- a/modules/gallery/tests/Gallery_Installer_Test.php +++ b/modules/gallery/tests/Gallery_Installer_Test.php @@ -31,9 +31,6 @@ class Gallery_Installer_Test extends Unit_Test_Case { public function install_registers_gallery_module_test() { $gallery = ORM::factory("module")->where("name", "gallery")->find(); $this->assert_equal("gallery", $gallery->name); - - // This is probably too volatile to keep for long - $this->assert_equal(2, $gallery->version); } public function install_creates_root_item_test() { -- cgit v1.2.3