User tests: Successful: Unsuccessful:
Pull Request for deprecated getQuery(true)
in joomla-cms because of framework database
Replaced all fuction calls getQuery(true)
with createQuery()
but only in database related context.
Note: There is also a getQuery(true) functionality in Joomla\CMS\Uri\Uri
that must remain untouched.
No extraordinary test instructions necessary.
Multiple php warnings (when enabled) resulting in e.g.
2023-11-14T12:20:46+00:00 WARNING 127.0.0.1 deprecated Since joomla/database 2.2.0: The parameter $new is deprecated and will be removed in 4.0, use Joomla\Database\DatabaseDriver::createQuery() instead. - [ROOT]/libraries/vendor/symfony/deprecation-contracts/function.php - Line 25
These warnings with "parameter $new" are gone.
Remember to change your mindset using the createQuery() to start building a query for the database, like:
$db = $this->getDatabase();
$query = $db->createQuery()
->select([$db->quotename('enabled'), $db->quoteName('params')])
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' = ' . $db->quote('actionlog'))
->where($db->quoteName('element') . ' = ' . $db->quote('joomla'));
$db->setQuery($query);
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_admin com_associations com_banners com_categories com_checkin com_config |
Title |
|
This pull request has been automatically rebased to 5.2-dev.
Title |
|
The createQuery()
method seems just a shortcut to call getQuery()
: https://github.com/joomla-framework/database/blob/56aa950aad3676702e71e84fa2014bf6e659b0b9/src/DatabaseDriver.php#L557
I don't see the getQuery()
method as deprecated
The
createQuery()
method seems just a shortcut to callgetQuery()
: https://github.com/joomla-framework/database/blob/56aa950aad3676702e71e84fa2014bf6e659b0b9/src/DatabaseDriver.php#L557I don't see the
getQuery()
method as deprecated
The parameter $new is deprecated.
Labels |
Added:
Feature
PR-5.2-dev
|
I'm sorry that I'm only now able to join in again, but unfortunately I've been very ill and have been absent for a long time.
@xillibit yes it seem to be just a shortcut to call getQuery(true)
but it isn't. The function getQuery(false)
or simply getQuery()
does exactly what a “get” describes, it fetches the current query.
The library changed this to be more clear: to create a query object aka createQuery()
.
I don't know if this is described in Joomla documentation, like how to design an SQL query?
I fixed the conflicts, @Hackwar @pe7er @HLeithner
Sorry, I have seen, that there are some code for reworking too! - Please do not check until the following is also to be changed:
$db = Factory::getDbo();
I will clone the 5.2-dev branch again, and fix that too - causing troubles.
Category | Administration com_admin com_associations com_banners com_categories com_checkin com_config | ⇒ | Administration com_admin com_associations com_banners com_categories |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-09-02 00:11:46 |
Closed_By | ⇒ | tkuschel |
Sorry, I have seen, that there are some code for reworking too! - Please do not check until the following is also to be changed:
$db = Factory::getDbo();
I will clone the 5.2-dev branch again, and fix that too - causing troubles.
Please don't, just do the createQuery() thing. Fixing Factory::getDbo();
is a much more complicated thing and should be done in a proper way.
@tkuschel As soon as I applied the Patch, (logging was turned off at that moment on purpose), the site crashed magnificently :(
Error UndefinedMethodError
HTTP 500 Whoops, looks like something went wrong.
Attempted to call an undefined method named "isAutostart" of class "Joomla\Component\Guidedtours\Administrator\Model\TourModel".
Symfony\Component\ErrorHandler\Error
UndefinedMethodError
in /home/lights/public_html/plugins/system/guidedtours/src/Extension/GuidedTours.php (line 172)
'Tour', 'Administrator', ['ignore_request' => true] ); if ($tourModel->isAutostart('joomla-welcome')) { $tour = $this->getTour('joomla-welcome'); $doc->addScriptOptions('com_guidedtours.autotour', $tour->id); // Set autostart to '0' to avoid it to autostart again
in /home/lights/public_html/libraries/vendor/joomla/event/src/Dispatcher.php -> onBeforeCompileHead (line 454)
Dispatcher->dispatch('onBeforeCompileHead', object(BeforeCompileHeadEvent))
in /home/lights/public_html/libraries/src/Document/Renderer/Html/MetasRenderer.php (line 62)
MetasRenderer->render(null, array(), null)
in /home/lights/public_html/libraries/src/Document/HtmlDocument.php (line 575)
HtmlDocument->getBuffer('metas', null, array())
in /home/lights/public_html/libraries/src/Document/HtmlDocument.php (line 894)
HtmlDocument->_renderTemplate()
in /home/lights/public_html/libraries/src/Document/HtmlDocument.php (line 647)
HtmlDocument->render(false, array('template' => 'atum', 'directory' => '/home/lights/public_html/administrator/templates', 'debug' => true, 'csp_nonce' => null, 'templateInherits' => '', 'params' => object(Registry), 'file' => 'error.php'))
in /home/lights/public_html/libraries/src/Document/ErrorDocument.php (line 139)
ErrorDocument->render(false, array('template' => 'atum', 'directory' => '/home/lights/public_html/administrator/templates', 'debug' => true, 'csp_nonce' => null, 'templateInherits' => '', 'params' => object(Registry), 'file' => 'error.php'))
in /home/lights/public_html/libraries/src/Error/Renderer/HtmlRenderer.php (line 70)
HtmlRenderer->render(object(Error))
in /home/lights/public_html/libraries/src/Exception/ExceptionHandler.php (line 136)
ExceptionHandler::render(object(Error))
in /home/lights/public_html/libraries/src/Exception/ExceptionHandler.php (line 73)
ExceptionHandler::handleException(object(Error))
in /home/lights/public_html/libraries/src/Application/CMSApplication.php (line 336)
CMSApplication->execute()
in /home/lights/public_html/administrator/includes/app.php (line 58)
require_once('/home/lights/public_html/administrator/includes/app.php')
in /home/lights/public_html/administrator/index.php (line 32)
Error
Call to undefined method Joomla\Component\Guidedtours\Administrator\Model\TourModel::isAutostart()
;(
Any way to revert the patch and uncrash my test site please? ;) lol
Thanks.