summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/book/book.module2
-rw-r--r--modules/comment/comment.module18
-rw-r--r--modules/comment/comment.pages.inc2
-rw-r--r--modules/simpletest/tests/file.test32
-rw-r--r--modules/simpletest/tests/schema.test2
5 files changed, 44 insertions, 12 deletions
diff --git a/modules/book/book.module b/modules/book/book.module
index 5b0f5f643..fad546bda 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -305,7 +305,7 @@ function book_get_books() {
}
}
}
-
+
return $all_books;
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index c8573d7c0..4730dc0a3 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -370,16 +370,16 @@ function comment_new_page_count($num_comments, $new_replies, $node) {
else {
// Threaded comments.
// Find the first thread with a new comment.
- $result = db_query_range('(SELECT thread
- FROM {comments}
- WHERE nid = :nid
- AND status = 0
- ORDER BY timestamp DESC)
+ $result = db_query_range('(SELECT thread
+ FROM {comments}
+ WHERE nid = :nid
+ AND status = 0
+ ORDER BY timestamp DESC)
ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1))', array(':nid' => $node->nid), 0, $new_replies)
->fetchField();
$thread = substr($result, 0, -1);
$count = db_query('SELECT COUNT(*) FROM {comments} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array(
- ':nid' => $node->nid,
+ ':nid' => $node->nid,
':thread' => $thread))
->fetchField();
$pageno = $count / $comments_per_page;
@@ -763,7 +763,7 @@ function comment_save($edit) {
$parent->thread = (string) rtrim((string) $parent->thread, '/');
// Get the max value in *this* thread.
$max = db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE :thread AND nid = :nid", array(
- ':thread' => $parent->thread .'.%',
+ ':thread' => $parent->thread .'.%',
':nid' => $edit['nid']))
->fetchField();
@@ -1006,7 +1006,7 @@ function comment_render($node, $cid = 0) {
}
}
else {
-
+
//TODO Convert to dynamic queries once the pager query is updated to the new DBTNG API.
// Multiple comment view.
@@ -1150,7 +1150,7 @@ function comment_num_replies($pid) {
if (!isset($cache[$pid])) {
$cache[$pid] = db_query('SELECT COUNT(cid) FROM {comments} WHERE pid = :pid AND status = :status', array(
- ':pid' => $pid,
+ ':pid' => $pid,
':status' => COMMENT_PUBLISHED))
->fetchField();
}
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc
index d1a3026fd..cc2913520 100644
--- a/modules/comment/comment.pages.inc
+++ b/modules/comment/comment.pages.inc
@@ -70,7 +70,7 @@ function comment_reply($node, $pid = NULL) {
if ($pid) {
// Load the comment whose cid = $pid
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
- ':cid'=>$pid,
+ ':cid'=>$pid,
':status'=>COMMENT_PUBLISHED))->fetchObject();
if ( $comment ) {
// If that comment exists, make sure that the current comment and the
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index 564ecea35..5da57ee5a 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -542,6 +542,38 @@ class FileDirectoryTest extends FileTestCase {
/**
+ * Tests the file_scan_directory() function.
+ */
+class FileScanDirectoryTest extends FileTestCase {
+ /**
+ * Implementation of getInfo().
+ */
+ function getInfo() {
+ return array(
+ 'name' => t('File scan directory'),
+ 'description' => t('Tests the file_scan_directory() function.'),
+ 'group' => t('File'),
+ );
+ }
+
+ /**
+ * Check that the no-mask parameter is honored.
+ */
+ function testNoMask() {
+ $path = $this->original_file_directory . '/simpletest';
+
+ // Grab a listing of all the JS files.
+ $all_files = file_scan_directory($path, '/javascript*/');
+ $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.'));
+
+ // Now use the nomast parameter to filter out the .script file.
+ $filtered_files = file_scan_directory($path, '/javascript*/', '/.script$/');
+ $this->assertEqual(1, count($filtered_files), t('Filtered correctly.'));
+ }
+}
+
+
+/**
* Deletion related tests.
*/
class FileUnmanagedDeleteTest extends FileTestCase {
diff --git a/modules/simpletest/tests/schema.test b/modules/simpletest/tests/schema.test
index eeafc7796..1e287e06d 100644
--- a/modules/simpletest/tests/schema.test
+++ b/modules/simpletest/tests/schema.test
@@ -19,7 +19,7 @@ class SchemaTestCase extends DrupalWebTestCase {
}
/**
- *
+ *
*/
function testSchema() {
// Try creating a table.