mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Updating queries to be more DB agnostic
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@66506 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f067bd1304
commit
e79dd5558b
@ -237,7 +237,7 @@ JS
|
|||||||
$fileNames = array();
|
$fileNames = array();
|
||||||
foreach($newFiles as $newFile) {
|
foreach($newFiles as $newFile) {
|
||||||
$fileIDs[] = $newFile;
|
$fileIDs[] = $newFile;
|
||||||
$fileObj = DataObject::get_one('File', "\"File\".ID=$newFile");
|
$fileObj = DataObject::get_one('File', "\"File\".\"ID\"=$newFile");
|
||||||
$fileNames[] = $fileObj->Name;
|
$fileNames[] = $fileObj->Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ HTML;
|
|||||||
$numFiles = 0;
|
$numFiles = 0;
|
||||||
|
|
||||||
if($fileList != "''") {
|
if($fileList != "''") {
|
||||||
$files = DataObject::get("File", "\"File\".ID IN ($fileList)");
|
$files = DataObject::get("File", "\"File\".\"ID\" IN ($fileList)");
|
||||||
if($files) {
|
if($files) {
|
||||||
foreach($files as $file) {
|
foreach($files as $file) {
|
||||||
if($file instanceof Image) {
|
if($file instanceof Image) {
|
||||||
@ -350,7 +350,7 @@ HTML;
|
|||||||
$brokenPageList = '';
|
$brokenPageList = '';
|
||||||
|
|
||||||
if($fileList != "''") {
|
if($fileList != "''") {
|
||||||
$files = DataObject::get("File", "\"File\".ID IN ($fileList)");
|
$files = DataObject::get("File", "\"File\".\"ID\" IN ($fileList)");
|
||||||
if($files) {
|
if($files) {
|
||||||
foreach($files as $file) {
|
foreach($files as $file) {
|
||||||
if($file instanceof Image) {
|
if($file instanceof Image) {
|
||||||
|
@ -46,7 +46,7 @@ class AssetTableField extends ComplexTableField {
|
|||||||
function setFolder($folder) {
|
function setFolder($folder) {
|
||||||
$this->folder = $folder;
|
$this->folder = $folder;
|
||||||
$this->sourceFilter .= ($this->sourceFilter) ? " AND " : "";
|
$this->sourceFilter .= ($this->sourceFilter) ? " AND " : "";
|
||||||
$this->sourceFilter .= " ParentID = '" . $folder->ID . "' AND ClassName <> 'Folder'";
|
$this->sourceFilter .= " \"ParentID\" = '" . $folder->ID . "' AND \"ClassName\" <> 'Folder'";
|
||||||
}
|
}
|
||||||
|
|
||||||
function Folder() {
|
function Folder() {
|
||||||
|
@ -513,7 +513,7 @@ JS;
|
|||||||
// DataObject::fieldExists only checks the current class, not the hierarchy
|
// DataObject::fieldExists only checks the current class, not the hierarchy
|
||||||
// This allows the CMS to set the correct sort value
|
// This allows the CMS to set the correct sort value
|
||||||
if($newItem->castingHelperPair('Sort')) {
|
if($newItem->castingHelperPair('Sort')) {
|
||||||
$newItem->Sort = DB::query("SELECT MAX(Sort) FROM SiteTree WHERE ParentID = '" . Convert::raw2sql($parentID) . "'")->value() + 1;
|
$newItem->Sort = DB::query("SELECT MAX(\"Sort\") FROM \"SiteTree\" WHERE \"ParentID\" = '" . Convert::raw2sql($parentID) . "'")->value() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Member::currentUser() )
|
if( Member::currentUser() )
|
||||||
@ -596,7 +596,7 @@ JS;
|
|||||||
*/
|
*/
|
||||||
public function delete($urlParams, $form) {
|
public function delete($urlParams, $form) {
|
||||||
$id = $_REQUEST['ID'];
|
$id = $_REQUEST['ID'];
|
||||||
$record = DataObject::get_one("SiteTree", "SiteTree.\"ID\" = $id");
|
$record = DataObject::get_one("SiteTree", "\"SiteTree\".\"ID\" = $id");
|
||||||
if($record && !$record->canDelete()) return Security::permissionFailure();
|
if($record && !$record->canDelete()) return Security::permissionFailure();
|
||||||
|
|
||||||
$recordID = $record->ID;
|
$recordID = $record->ID;
|
||||||
@ -662,7 +662,7 @@ JS;
|
|||||||
if($groupIDs) {
|
if($groupIDs) {
|
||||||
$groupList = implode(", ", $groupIDs);
|
$groupList = implode(", ", $groupIDs);
|
||||||
$members = DataObject::get("Member","","",
|
$members = DataObject::get("Member","","",
|
||||||
"INNER JOIN \"Group_Members\" ON \"Group_Members\".MemberID = \"Member\".ID AND \"Group_Members\".GroupID IN ($groupList)");
|
"INNER JOIN \"Group_Members\" ON \"Group_Members\".\"MemberID\" = \"Member\".\"ID\" AND \"Group_Members\".\"GroupID\" IN ($groupList)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($members) {
|
if($members) {
|
||||||
@ -687,7 +687,7 @@ HTML;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tasklist() {
|
function tasklist() {
|
||||||
$tasks = DataObject::get("Page", "AssignedToID = " . Member::currentUserID(), "Created DESC");
|
$tasks = DataObject::get("Page", "\"AssignedToID\" = " . Member::currentUserID(), "\"Created\" DESC");
|
||||||
if($tasks) {
|
if($tasks) {
|
||||||
$data = new ArrayData(array(
|
$data = new ArrayData(array(
|
||||||
"Tasks" => $tasks,
|
"Tasks" => $tasks,
|
||||||
@ -702,7 +702,7 @@ HTML;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function waitingon() {
|
function waitingon() {
|
||||||
$tasks = DataObject::get("Page", "RequestedByID = " . Member::currentUserID(), "Created DESC");
|
$tasks = DataObject::get("Page", "\"RequestedByID\" = " . Member::currentUserID(), "\"Created\" DESC");
|
||||||
if($tasks) {
|
if($tasks) {
|
||||||
$data = new ArrayData(array(
|
$data = new ArrayData(array(
|
||||||
"Tasks" => $tasks,
|
"Tasks" => $tasks,
|
||||||
@ -718,7 +718,7 @@ HTML;
|
|||||||
|
|
||||||
function comments() {
|
function comments() {
|
||||||
if($this->urlParams['ID']) {
|
if($this->urlParams['ID']) {
|
||||||
$comments = DataObject::get("WorkflowPageComment", "PageID = " . $this->urlParams['ID'], "Created DESC");
|
$comments = DataObject::get("WorkflowPageComment", "\"PageID\" = " . $this->urlParams['ID'], "\"Created\" DESC");
|
||||||
$data = new ArrayData(array(
|
$data = new ArrayData(array(
|
||||||
"Comments" => $comments,
|
"Comments" => $comments,
|
||||||
));
|
));
|
||||||
@ -1169,7 +1169,7 @@ HTML;
|
|||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
$excludePages = split(" *, *", $_GET['exclude']);
|
$excludePages = split(" *, *", $_GET['exclude']);
|
||||||
|
|
||||||
$pages = DataObject::get("SiteTree", "ParentID = 0");
|
$pages = DataObject::get("SiteTree", "\"ParentID\" = 0");
|
||||||
foreach($pages as $page) $pageArr[] = $page;
|
foreach($pages as $page) $pageArr[] = $page;
|
||||||
|
|
||||||
while(list($i,$page) = each($pageArr)) {
|
while(list($i,$page) = each($pageArr)) {
|
||||||
@ -1241,7 +1241,7 @@ HTML;
|
|||||||
$restoredPage = Versioned::get_latest_version("SiteTree", $id);
|
$restoredPage = Versioned::get_latest_version("SiteTree", $id);
|
||||||
$restoredPage->ID = $restoredPage->RecordID;
|
$restoredPage->ID = $restoredPage->RecordID;
|
||||||
if(!DB::query("SELECT \"ID\" FROM \"SiteTree\" WHERE \"ID\" = $restoredPage->ID")->value()) {
|
if(!DB::query("SELECT \"ID\" FROM \"SiteTree\" WHERE \"ID\" = $restoredPage->ID")->value()) {
|
||||||
DB::query("INSERT INTO \"SiteTree\" SET \"ID\" = $restoredPage->ID");
|
DB::query("INSERT INTO \"SiteTree\" (\"ID\") VALUES ($restoredPage->ID)");
|
||||||
}
|
}
|
||||||
$restoredPage->forceChange();
|
$restoredPage->forceChange();
|
||||||
$restoredPage->writeWithoutVersion();
|
$restoredPage->writeWithoutVersion();
|
||||||
|
@ -55,17 +55,17 @@ class CommentAdmin extends LeftAndMain {
|
|||||||
$section = $this->Section();
|
$section = $this->Section();
|
||||||
|
|
||||||
if($section == 'approved') {
|
if($section == 'approved') {
|
||||||
$filter = 'IsSpam=0 AND NeedsModeration=0';
|
$filter = 'NOT "IsSpam" AND NOT "NeedsModeration"';
|
||||||
$title = "<h2>". _t('CommentAdmin.APPROVEDCOMMENTS', 'Approved Comments')."</h2>";
|
$title = "<h2>". _t('CommentAdmin.APPROVEDCOMMENTS', 'Approved Comments')."</h2>";
|
||||||
} else if($section == 'unmoderated') {
|
} else if($section == 'unmoderated') {
|
||||||
$filter = 'NeedsModeration=1';
|
$filter = '"NeedsModeration"';
|
||||||
$title = "<h2>"._t('CommentAdmin.COMMENTSAWAITINGMODERATION', 'Comments Awaiting Moderation')."</h2>";
|
$title = "<h2>"._t('CommentAdmin.COMMENTSAWAITINGMODERATION', 'Comments Awaiting Moderation')."</h2>";
|
||||||
} else {
|
} else {
|
||||||
$filter = 'IsSpam=1';
|
$filter = '"IsSpam"';
|
||||||
$title = "<h2>"._t('CommentAdmin.SPAM', 'Spam')."</h2>";
|
$title = "<h2>"._t('CommentAdmin.SPAM', 'Spam')."</h2>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter .= ' AND ParentID>0';
|
$filter .= ' AND "ParentID">0';
|
||||||
|
|
||||||
$tableFields = array(
|
$tableFields = array(
|
||||||
"Name" => _t('CommentAdmin.AUTHOR', 'Author'),
|
"Name" => _t('CommentAdmin.AUTHOR', 'Author'),
|
||||||
@ -125,7 +125,7 @@ class CommentAdmin extends LeftAndMain {
|
|||||||
|
|
||||||
if($_REQUEST['Comments']) {
|
if($_REQUEST['Comments']) {
|
||||||
foreach($_REQUEST['Comments'] as $commentid) {
|
foreach($_REQUEST['Comments'] as $commentid) {
|
||||||
$comment = DataObject::get_one('PageComment', "\"PageComment\".ID = $commentid");
|
$comment = DataObject::get_one('PageComment', "\"PageComment\".\"ID\" = $commentid");
|
||||||
if($comment) {
|
if($comment) {
|
||||||
$comment->delete();
|
$comment->delete();
|
||||||
$numComments++;
|
$numComments++;
|
||||||
@ -144,7 +144,7 @@ JS;
|
|||||||
|
|
||||||
function deleteall() {
|
function deleteall() {
|
||||||
$numComments = 0;
|
$numComments = 0;
|
||||||
$spam = DataObject::get('PageComment', 'PageComment.IsSpam=1');
|
$spam = DataObject::get('PageComment', '"PageComment"."IsSpam"');
|
||||||
|
|
||||||
if($spam) {
|
if($spam) {
|
||||||
$numComments = $spam->Count();
|
$numComments = $spam->Count();
|
||||||
@ -169,7 +169,7 @@ JS;
|
|||||||
|
|
||||||
if($_REQUEST['Comments']) {
|
if($_REQUEST['Comments']) {
|
||||||
foreach($_REQUEST['Comments'] as $commentid) {
|
foreach($_REQUEST['Comments'] as $commentid) {
|
||||||
$comment = DataObject::get_one('PageComment', "\"PageComment\".ID = $commentid");
|
$comment = DataObject::get_one('PageComment', "\"PageComment\".\"ID\" = $commentid");
|
||||||
if($comment) {
|
if($comment) {
|
||||||
$comment->IsSpam = true;
|
$comment->IsSpam = true;
|
||||||
$comment->NeedsModeration = false;
|
$comment->NeedsModeration = false;
|
||||||
@ -208,7 +208,7 @@ JS;
|
|||||||
|
|
||||||
if($_REQUEST['Comments']) {
|
if($_REQUEST['Comments']) {
|
||||||
foreach($_REQUEST['Comments'] as $commentid) {
|
foreach($_REQUEST['Comments'] as $commentid) {
|
||||||
$comment = DataObject::get_one('PageComment', "\"PageComment\".ID = $commentid");
|
$comment = DataObject::get_one('PageComment', "\"PageComment\".\"ID\" = $commentid");
|
||||||
if($comment) {
|
if($comment) {
|
||||||
$comment->IsSpam = false;
|
$comment->IsSpam = false;
|
||||||
$comment->NeedsModeration = false;
|
$comment->NeedsModeration = false;
|
||||||
@ -248,7 +248,7 @@ JS;
|
|||||||
|
|
||||||
if($_REQUEST['Comments']) {
|
if($_REQUEST['Comments']) {
|
||||||
foreach($_REQUEST['Comments'] as $commentid) {
|
foreach($_REQUEST['Comments'] as $commentid) {
|
||||||
$comment = DataObject::get_one('PageComment', "\"PageComment\".ID = $commentid");
|
$comment = DataObject::get_one('PageComment', "\"PageComment\".\"ID\" = $commentid");
|
||||||
if($comment) {
|
if($comment) {
|
||||||
$comment->IsSpam = false;
|
$comment->IsSpam = false;
|
||||||
$comment->NeedsModeration = false;
|
$comment->NeedsModeration = false;
|
||||||
@ -272,21 +272,21 @@ JS;
|
|||||||
* Return the number of moderated comments
|
* Return the number of moderated comments
|
||||||
*/
|
*/
|
||||||
function NumModerated() {
|
function NumModerated() {
|
||||||
return DB::query("SELECT COUNT(*) FROM PageComment WHERE !IsSpam AND !NeedsModeration")->value();
|
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE NOT \"IsSpam\" AND NOT \"NeedsModeration\"")->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of unmoderated comments
|
* Return the number of unmoderated comments
|
||||||
*/
|
*/
|
||||||
function NumUnmoderated() {
|
function NumUnmoderated() {
|
||||||
return DB::query("SELECT COUNT(*) FROM PageComment WHERE !IsSpam AND NeedsModeration")->value();
|
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE NOT \"IsSpam\" AND \"NeedsModeration\"")->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of comments marked as spam
|
* Return the number of comments marked as spam
|
||||||
*/
|
*/
|
||||||
function NumSpam() {
|
function NumSpam() {
|
||||||
return DB::query("SELECT COUNT(*) FROM PageComment WHERE IsSpam")->value();
|
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"")->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class FileList extends TableListField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sourceItems() {
|
function sourceItems() {
|
||||||
return DataObject::get("File", "ParentID = '" . $this->folder->ID . "' AND ClassName <> 'Folder'", "Title");
|
return DataObject::get("File", "\"ParentID\" = '" . $this->folder->ID . "' AND \"ClassName\" <> 'Folder'", '"Title"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class ImageEditor extends Controller {
|
|||||||
if(strpos($originalFile,'?') !== false) $originalFile = substr($originalFile,0,strpos($originalFile,'?'));
|
if(strpos($originalFile,'?') !== false) $originalFile = substr($originalFile,0,strpos($originalFile,'?'));
|
||||||
if($this->checkFileExists($originalFile) && $this->checkFileExists($editedFile)) {
|
if($this->checkFileExists($originalFile) && $this->checkFileExists($editedFile)) {
|
||||||
if($editedFile != $originalFile && copy($this->url2File($editedFile),$this->url2File($originalFile))) {
|
if($editedFile != $originalFile && copy($this->url2File($editedFile),$this->url2File($originalFile))) {
|
||||||
$image = DataObject::get_one('File','Filename = \'' . substr($this->url2File($originalFile),3) . '\'');
|
$image = DataObject::get_one('File','"Filename" = \'' . substr($this->url2File($originalFile),3) . '\'');
|
||||||
$image->deleteFormattedImages();
|
$image->deleteFormattedImages();
|
||||||
$image->generateFormattedImage('AssetLibraryPreview');
|
$image->generateFormattedImage('AssetLibraryPreview');
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,7 +85,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
$fieldVal = $_REQUEST[$fieldName];
|
$fieldVal = $_REQUEST[$fieldName];
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
$matches = DataObject::get($this->stat('subitem_class'),"$fieldName LIKE '" . addslashes($fieldVal) . "%'");
|
$matches = DataObject::get($this->stat('subitem_class'),"\"$fieldName\" LIKE '" . addslashes($fieldVal) . "%'");
|
||||||
if($matches) {
|
if($matches) {
|
||||||
$result .= "<ul>";
|
$result .= "<ul>";
|
||||||
foreach($matches as $match) {
|
foreach($matches as $match) {
|
||||||
@ -153,7 +153,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
if($id == 'new') $id = null;
|
if($id == 'new') $id = null;
|
||||||
|
|
||||||
if($id) {
|
if($id) {
|
||||||
$record = DataObject::get_one($className, "\"$className\".ID = $id");
|
$record = DataObject::get_one($className, "\"$className\".\"ID\" = $id");
|
||||||
} else {
|
} else {
|
||||||
$record = new $className();
|
$record = new $className();
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class SideReport_EmptyPages extends SideReport {
|
|||||||
return _t('SideReport.EMPTYPAGES',"Empty pages");
|
return _t('SideReport.EMPTYPAGES',"Empty pages");
|
||||||
}
|
}
|
||||||
function records() {
|
function records() {
|
||||||
return DataObject::get("SiteTree", "Content = '' OR Content IS NULL OR Content LIKE '<p></p>' OR Content LIKE '<p> </p>'", "Title");
|
return DataObject::get("SiteTree", "\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '<p></p>' OR \"Content\" LIKE '<p> </p>'", '"Title"');
|
||||||
}
|
}
|
||||||
function fieldsToShow() {
|
function fieldsToShow() {
|
||||||
return array(
|
return array(
|
||||||
@ -87,7 +87,7 @@ class SideReport_RecentlyEdited extends SideReport {
|
|||||||
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
||||||
}
|
}
|
||||||
function records() {
|
function records() {
|
||||||
return DataObject::get("SiteTree", "\"SiteTree\".LastEdited > NOW() - INTERVAL 14 DAY", "\"SiteTree\".\"LastEdited\" DESC");
|
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > NOW() - INTERVAL 14 DAY", "\"SiteTree\".\"LastEdited\" DESC");
|
||||||
}
|
}
|
||||||
function fieldsToShow() {
|
function fieldsToShow() {
|
||||||
return array(
|
return array(
|
||||||
@ -101,7 +101,7 @@ class SideReport_ToDo extends SideReport {
|
|||||||
return _t('SideReport.TODO',"To do");
|
return _t('SideReport.TODO',"To do");
|
||||||
}
|
}
|
||||||
function records() {
|
function records() {
|
||||||
return DataObject::get("SiteTree", "\"SiteTree\".ToDo IS NOT NULL AND \"SiteTree\".ToDo <> ''", "\"SiteTree\".\"LastEdited\" DESC");
|
return DataObject::get("SiteTree", "\"SiteTree\".\"ToDo\" IS NOT NULL AND \"SiteTree\".\"ToDo\" <> ''", "\"SiteTree\".\"LastEdited\" DESC");
|
||||||
}
|
}
|
||||||
function fieldsToShow() {
|
function fieldsToShow() {
|
||||||
return array(
|
return array(
|
||||||
|
@ -47,14 +47,14 @@ class ThumbnailStripField extends FormField {
|
|||||||
$folderList = $folder->getDescendantIDList('Folder');
|
$folderList = $folder->getDescendantIDList('Folder');
|
||||||
array_unshift($folderList, $folder->ID);
|
array_unshift($folderList, $folder->ID);
|
||||||
|
|
||||||
$whereSQL = 'ParentID IN (' . implode(', ', $folderList) . ')';
|
$whereSQL = '"ParentID" IN (' . implode(', ', $folderList) . ')';
|
||||||
if($searchText) $whereSQL .= " AND Filename LIKE '%$searchText%'";
|
if($searchText) $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'";
|
||||||
|
|
||||||
$images = DataObject::get('Image', $whereSQL, 'Title');
|
$images = DataObject::get('Image', $whereSQL, 'Title');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if($searchText) {
|
if($searchText) {
|
||||||
$whereSQL = "Filename LIKE '%$searchText%'";
|
$whereSQL = "\"Filename\" LIKE '%$searchText%'";
|
||||||
|
|
||||||
$images = DataObject::get('Image', $whereSQL, 'Title');
|
$images = DataObject::get('Image', $whereSQL, 'Title');
|
||||||
}
|
}
|
||||||
@ -113,13 +113,13 @@ class ThumbnailStripField extends FormField {
|
|||||||
$folderList = $folder->getDescendantIDList('Folder');
|
$folderList = $folder->getDescendantIDList('Folder');
|
||||||
array_unshift($folderList, $folder->ID);
|
array_unshift($folderList, $folder->ID);
|
||||||
|
|
||||||
$whereSQL = "ParentID IN (" . implode(', ', $folderList) . ") AND Filename LIKE '%.swf'";
|
$whereSQL = "\"ParentID\" IN (" . implode(', ', $folderList) . ") AND \"Filename\" LIKE '%.swf'";
|
||||||
if($searchText) $whereSQL .= " AND Filename LIKE '%$searchText%'";
|
if($searchText) $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'";
|
||||||
|
|
||||||
$flashObjects = DataObject::get('File', $whereSQL);
|
$flashObjects = DataObject::get('File', $whereSQL);
|
||||||
} else {
|
} else {
|
||||||
if($searchText) {
|
if($searchText) {
|
||||||
$flashObjects = DataObject::get('File', "Filename LIKE '%$searchText%' AND Filename LIKE '%.swf'");
|
$flashObjects = DataObject::get('File', "\"Filename\" LIKE '%$searchText%' AND \"Filename\" LIKE '%.swf'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ class PageComment extends DataObject {
|
|||||||
|
|
||||||
class PageComment_Controller extends Controller {
|
class PageComment_Controller extends Controller {
|
||||||
function rss() {
|
function rss() {
|
||||||
$parentcheck = isset($_REQUEST['pageid']) ? "ParentID = " . (int) $_REQUEST['pageid'] : "ParentID > 0";
|
$parentcheck = isset($_REQUEST['pageid']) ? "\"ParentID\" = " . (int) $_REQUEST['pageid'] : "\"ParentID\" > 0";
|
||||||
$comments = DataObject::get("PageComment", "$parentcheck AND IsSpam=0", "Created DESC", "", 10);
|
$comments = DataObject::get("PageComment", "$parentcheck AND NOT \"IsSpam\"", "\"Created\" DESC", "", 10);
|
||||||
if(!isset($comments)) {
|
if(!isset($comments)) {
|
||||||
$comments = new DataObjectSet();
|
$comments = new DataObjectSet();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class SiteTreeMaintenanceTask extends Controller {
|
|||||||
|
|
||||||
function makelinksunique() {
|
function makelinksunique() {
|
||||||
$badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'";
|
$badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'";
|
||||||
$pages = DataObject::get("SiteTree", "URLSegment IN ($badURLs)");
|
$pages = DataObject::get("SiteTree", "\"URLSegment\" IN ($badURLs)");
|
||||||
|
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
echo "<li>$page->Title: ";
|
echo "<li>$page->Title: ";
|
||||||
|
Loading…
Reference in New Issue
Block a user