Add quotes around all values that contain spaces in them, and add a

test to make sure that we continue to do so.

This makes sure that we don't have problems with 5.3 which treats the
literal "on" as a boolean.
This commit is contained in:
Bharat Mediratta
2009-07-13 10:36:55 -07:00
parent a944bf4259
commit e2a9a1d284
21 changed files with 74 additions and 37 deletions

View File

@@ -1,3 +1,3 @@
name = Akismet
name = "Akismet"
description = "Filter comments through the Akismet web service to detect and eliminate spam (http://akismet.com). You'll need a WordPress.com API key to use it."
version = 1

View File

@@ -1,3 +1,3 @@
name = Comments
name = "Comments"
description = "Allows users and guests to leave comments on photos and albums."
version = 2

View File

@@ -1,3 +1,3 @@
name = Digibug
description = Digibug Photo Printing Module
name = "Digibug"
description = "Digibug Photo Printing Module"
version = 2

View File

@@ -1,3 +1,3 @@
name = Exif Data
name = "Exif Data"
description = "Extract Exif data and display it on photo pages."
version = 1

View File

@@ -1,3 +1,3 @@
name = Gallery2 Import
description = Import your Gallery 2 content into Gallery 3
name = "Gallery2 Import"
description = "Import your Gallery 2 content into Gallery 3"
version = 1

View File

@@ -1,3 +1,3 @@
name = Gallery 3
description = Gallery core application
name = "Gallery 3"
description = "Gallery core application"
version = 6

View File

@@ -213,6 +213,43 @@ class File_Structure_Test extends Unit_Test_Case {
}
}
}
public function module_info_is_well_formed_test() {
$info_files = array_merge(
glob("modules/*/module.info"),
glob("themes/*/module.info"));
$errors = array();
foreach ($info_files as $file) {
foreach (file($file) as $line) {
$parts = explode("=", $line, 2);
$values[trim($parts[0])] = trim($parts[1]);
}
$module = dirname($file);
// Certain keys must exist
foreach (array("name", "description", "version") as $key) {
if (!array_key_exists($key, $values)) {
$errors[] = "$module: missing key $key";
}
}
// Any values containing spaces must be quoted
foreach ($values as $key => $value) {
if (strpos($value, " ") !== false && !preg_match('/^".*"$/', $value)) {
$errors[] = "$module: value for $key must be quoted";
}
}
// The file must parse
if (!is_array(parse_ini_file($file))) {
$errors[] = "$module: info file is not parseable";
}
}
if ($errors) {
$this->assert_true(false, $errors);
}
}
}
class PhpCodeFilterIterator extends FilterIterator {

View File

@@ -1,3 +1,3 @@
name = Image Block
description = Display a random image in the sidebar
name = "Image Block"
description = "Display a random image in the sidebar"
version = 1

View File

@@ -1,3 +1,3 @@
name = Info
description = Display extra information about photos and albums
name = "Info"
description = "Display extra information about photos and albums"
version = 1

View File

@@ -1,3 +1,3 @@
name = Notification
name = "Notification"
description = "Send notifications to users when changes are made to watched albums."
version = 1

View File

@@ -1,3 +1,3 @@
name = Organize
description = Organize your gallery by apply tags or moving images
name = "Organize"
description = "Organize your gallery by apply tags or moving images"
version = 1

View File

@@ -1,3 +1,3 @@
name = reCAPTCHA
name = "reCAPTCHA"
description = "reCAPTCHA displays a graphical verification that protects the input form from abuse from 'bots,' or automated programs usually written to generate spam (http://recaptcha.net)."
version = 1

View File

@@ -1,3 +1,3 @@
name = RSS
description = Provide a RSS feeds
name = "RSS"
description = "Provide a RSS feeds"
version = 1

View File

@@ -1,3 +1,3 @@
name = Search
description = Allows users to search their Gallery
name = "Search"
description = "Allows users to search their Gallery"
version = 1

View File

@@ -1,3 +1,3 @@
name = Server Add
description = Allows authorized users to load images directly from your web server
name = "Server Add"
description = "Allows authorized users to load images directly from your web server"
version = 3

View File

@@ -1,3 +1,3 @@
name = Slideshow
description = Allows users to view a slideshow of photos
name = "Slideshow"
description = "Allows users to view a slideshow of photos"
version = 1

View File

@@ -1,3 +1,3 @@
name = Tags
description = Allows users to tag photos and albums
name = "Tags"
description = "Allows users to tag photos and albums"
version = 1

View File

@@ -1,3 +1,3 @@
name = Users and Groups
description = Provides user and group management
name = "Users and Groups"
description = "Provides user and group management"
version = 1

View File

@@ -1,3 +1,3 @@
name = Watermarks
description = Allows users to watermark their photos
name = "Watermarks"
description = "Allows users to watermark their photos"
version = 1

View File

@@ -1,6 +1,6 @@
name = Gallery Default
description = A crisp Site Administration theme with soft colors and drop down menus.
name = "Gallery Default"
description = "A crisp Site Administration theme with soft colors and drop down menus."
version = 1
author = Gallery Team
author = "Gallery Team"
admin = 1
site = 0

View File

@@ -1,6 +1,6 @@
name = Gallery Default
description = A crisp and distinctive theme that uses large fonts and icons for easy navigation and an enjoyable browsing experience.
name = "Gallery Default"
description = "A crisp and distinctive theme that uses large fonts and icons for easy navigation and an enjoyable browsing experience."
version = 1
author = Gallery Team
author = "Gallery Team"
site = 1
admin = 0