Skip to content

Instantly share code, notes, and snippets.

View jonasraoni's full-sized avatar
☠️
Do what you want cause a pirate is free! You are a pirate!

Jonas Raoni Soares da Silva jonasraoni

☠️
Do what you want cause a pirate is free! You are a pirate!
View GitHub Profile
@jonasraoni
jonasraoni / example.php
Last active March 3, 2023 12:05
Performs an optimization at a SELECT statement which is intended to be enclosed by a counter query (e.g. "SELECT COUNT(0) FROM (YOUR_GENERIC_QUERY)") for pagination purposes
<?php
print_r(optimizeCountQuery(
'SELECT (SELECT drop FROM expensive WHERE true = ?) AS subquery
FROM table
WHERE (SELECT ?) = param
ORDER BY not_needed_for_count, drop = ?',
[true,'param', true]
));
/*
@jonasraoni
jonasraoni / I8073_RemoveNotesWithoutQueriesAndRelatedObjects.php
Last active May 8, 2023 13:30
Fixed lib\pkp\classes\migration\upgrade\v3_4_0\I8073_RemoveNotesWithoutQueriesAndRelatedObjects.php
<?php
/**
* @file classes/migration/upgrade/v3_4_0/I8073_RemoveNotesWithoutQueriesAndRelatedObjects.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2000-2022 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I8073_RemoveNotesWithoutQueriesAndRelatedObjects
@jonasraoni
jonasraoni / ArticleSearchDAO.php
Last active April 26, 2024 08:17
Handicapped search code for OJS 3.4
<?php
/**
* @file classes/search/ArticleSearchDAO.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ArticleSearchDAO