Skip to content

Instantly share code, notes, and snippets.

View nyeholt's full-sized avatar

Marcus nyeholt

  • Symbiote
  • Melbourne
View GitHub Profile
diff --git a/src/ResultList.php b/src/ResultList.php
index f941340..aefd6d0 100644
--- a/src/ResultList.php
+++ b/src/ResultList.php
@@ -55,7 +55,7 @@ class ResultList extends ViewableData implements SS_List, Limitable
//If we are in live reading mode, only return published documents
if (Versioned::get_stage() == Versioned::LIVE) {
- $publishedFilter = new Query\BoolQuery();
+ $publishedFilter = $query->hasParam('post_filter') ? $query->getParam('post_filter') : new Query\BoolQuery();
@nyeholt
nyeholt / build-config.php
Created February 18, 2020 01:58
Builds satis config from a composer.lock file
<?php
$lockfile = json_decode(file_get_contents(__DIR__ . '/../composer.lock'), true);
$satis = [
'name' => 'my/project-dependencies',
'homepage' => 'http://apache/satis/web',
'repositories' => [
[
"type" => "composer",
diff --git vendor/heyday/silverstripe-elastica/src/ResultList.php vendor/heyday/silverstripe-elastica/src/ResultList.php
index a178198..13b9f65 100644
--- vendor/heyday/silverstripe-elastica/src/ResultList.php
+++ vendor/heyday/silverstripe-elastica/src/ResultList.php
@@ -41,11 +41,19 @@ class ResultList extends ViewableData implements SS_List
'_type'
));
+ $query->setSource([
+ 'ID',
<?php
class Page extends SiteTree implements NotifiedOn {
private static $db = array(
);
private static $has_one = array(
);
@nyeholt
nyeholt / .gitconfig
Created January 7, 2016 22:23
Git aliases
[alias]
update-from = "!f() { git fetch $1 --prune; git merge --ff-only $1/$2 || git rebase --preserve-merges $1/$2; }; f"
ff = merge --ff-only
nf = merge --no-ff
diff --git a/filesystem/File.php b/filesystem/File.php
index 026a7bf..0082dfe 100644
--- a/filesystem/File.php
+++ b/filesystem/File.php
@@ -646,7 +646,7 @@ class File extends DataObject {
* @return string
*/
public function getAbsoluteURL() {
- return Director::absoluteBaseURL() . $this->getFilename();
+ return Director::absoluteURL($this->getURL());
<?php
if (defined('YML_PROXY_CONFIG_FILE')) {
$ymlFile = YML_PROXY_CONFIG_FILE;
if ($ymlFile{0} != '/') {
$ymlFile = BASE_PATH . '/' . $ymlFile;
}
$publisherName = defined('PROXY_PUBLISHER') ? PROXY_PUBLISHER : null;
$dynamicName = defined('PROXY_DYNAMIC_PUBLISHER') ? PROXY_DYNAMIC_PUBLISHER : null;
$array = Yaml::parse(file_get_contents($ymlFile));
<?php
/**
* Redirects write queries to a specific database configuration
*
* @author <marcus@silverstripe.com.au>
* @license BSD License http://www.silverstripe.org/bsd-license
*/
class MySQLWriteDbAspect implements BeforeCallAspect {
/**
Injector:
S3Service:
constructor:
- kidding
- right?
S3ContentReader:
type: prototype
properties:
s3service: %$S3Service
bucket: kfc
@nyeholt
nyeholt / Gruntfile.js
Created December 9, 2015 23:31
Grunt config
module.exports = function(grunt) {
// COMMANDS
// comple css and js - $ grunt
// optim - run $ grunt imgoptim
// FILE STRUCTURE
// css/app.css, css/app.min.css