How to add custom function ot User.php in MediaWiki? - php

I added the following custom function to User.php:
public function isUpgraded() {
return true;
}
and the following in my Foreground.skin.php which is my skin/theme for the wiki to simply access the value that the function returns:
$isUpgraded= $wgUser->isUpgraded();
but I get the following exception:
Fatal error: Uncaught Error: Call to undefined method User::isUpgraded() in /home/siteX/public_html/siteX.com/wiki/skins/foreground/Foreground.skin.php:106 Stack trace: #0 /home/siteX/public_html/siteX.com/wiki/includes/skins/SkinTemplate.php(251): foregroundTemplate->execute() #1 /home/siteX/public_html/siteX.com/wiki/includes/OutputPage.php(2388): SkinTemplate->outputPage() #2 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionRenderer.php(135): OutputPage->output() #3 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionRenderer.php(54): MWExceptionRenderer::reportHTML(Object(Error)) #4 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionHandler.php(75): MWExceptionRenderer::output(Object(Error), 2) #5 /home/siteX/public_html/siteX.com/wiki/includes/exception/MWExceptionHandler.php(149): MWExceptionHandler::report(Object(Error)) #6 /home/siteX/public_html/dev. in /home/siteX/public_html/siteX.com/wiki/skins/foreground/Foreground.skin.php on line 106
Do I need to register the custom function in some other file in order for it to work? It might be worth mentioning that the code worked in MediaWiki 1.23 but I recently updated to 1.31 and can't get the following piece of code to work.

Related

Magento 1.9.3 Uncaught Error: Call to a member function getMethodInstance() on boolean Payment/Model/Observer.php

I am using Magento version 1.9.3 and payment gateway from CCAvenue.
At the time of checkout and sucessfull making the payment, when returning back to the website from CCAvenue. I am getting this error instead of successfull payment:
Fatal error: Uncaught Error: Call to a member function getMethodInstance() on boolean in app/code/core/Mage/Payment/Model/Observer.php:46 Stack trace:
#0 app/code/core/Mage/Core/Model/App.php(1358): Mage_Payment_Model_Observer->salesOrderBeforeSave(Object(Varien_Event_Observer))
#1 app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Payment_Model_Observer), 'salesOrderBefor...', Object(Varien_Event_Observer))
#2 app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('sales_order_sav...', Array)
#3 app/code/core/Mage/Core/Model/Abstract.php(391): Mage::dispatchEvent('sales_order_sav...', Array)
#4 app/code/core/Mage/Sales/Model/Order.php(2117): Mage_Core_Model_Abstract->_beforeSave()
#5 app/code/core/Mage/Core/Model/Abstract.php(316): Mage_Sales_Model_Order-> in app/code/core/Mage/Payment/Model/Observer.php on line 46
So far, I googled for solutions and tried couple of things like below:
$payment = $order->getPayment();
if(!isset($payment)) {
return $this->_redirect('checkout/cart');
}
With this solution, I am able to return to the checkout/cart but with the message of invalid access. Whereas the order is successfully done and the payment has deduction applied in all the cases.
I have also check the log but there is nothing that I can trace and rectify, FYI, here is the log relevant to it:
Stack trace:
#0 app/code/core/Mage/Core/Model/App.php(1358): Mage_Payment_Model_Observer->salesOrderBeforeSave(Object(Varien_Event_Observer))
#1 app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Payment_Model_Observer), 'salesOrderBefor...', Object(Varien_Event_Observer))
#2 app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('sales_order_sav...', Array)
#3 app/code/core/Mage/Core/Model/Abstract.php(391): Mage::dispatchEvent('sales_order_sav...', Array)
#4 app/code/core/Mage/Sales/Model/Order.php(2117): Mage_Core_Model_Abstract->_beforeSave()
#5 app/code/core/Mage/Core/Model/Abstract.php(316): Mage_Sales_Model_Order-> in app/code/core/Mage/Payment/Model/Observer.php on line 46
This happens when order object is not loaded correctly.
In this case "order id" from session is missing while loading order object.
In CcavenuepayController.php, response handler function
search for
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
Replace with
$order = Mage::getModel('sales/order')->loadByIncrementId($response_array['order_id']);
We are replacing session order id with ccavenue response order id.

Fatal error: Uncaught Error: Call to undefined method stdClass::option();

**Fatal error: Uncaught Error: Call to undefined method stdClass::option() in
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\helpers\taxonomies.php:19
Stack trace: #0
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\loader.php(55):
Bunch_Taxonomies->__construct() #1
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\loader.php(77):
_load_plugins_class('taxonomies', 'helpers', false) #2 C:\xampp\htdocs\newtest\wordpress\wp-includes\class-wp-hook.php(286):
_bunch_plugin_init('') #3 C:\xampp\htdocs\newtest\wordpress\wp-includes\class-wp-hook.php(310):
WP_Hook->apply_filters(NULL, Array) #4
C:\xampp\htdocs\newtest\wordpress\wp-includes\plugin.php(465):
WP_Hook->do_action(Array) #5
C:\xampp\htdocs\newtest\wordpress\wp-settings.php(505):
do_action('init') #6
C:\xampp\htdocs\newtest\wordpress\wp-config.php(90):
require_once('C:\\xampp\\htdocs...') #7
C:\xampp\htdocs\newtest\wordpress\wp-load.php(37):
require_once('C:\\xampp\\htdocs.. in
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\helpers\taxonomies.php
on line 19**
This Error occurs when I am including new theme in my WordPress account. That time I am using meson theme and try to include new theme and suddenly this error occurs. so guide me on what to do for solving this.
Deactivate all plugins associated with the last theme, I can see that the error caused by theme_support_meson plugin so make sure to deactivate it then delete it.

Zf2 "The iterator class does not exist" on Session\Container definition

Sometimes on my website (ZendFramework2), I get an error when setting a session variable.
The error:
PHP Fatal error: Uncaught exception 'Zend\\Stdlib\\Exception\\InvalidArgumentException' with message 'The iterator class does not exist' in /MySite/vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject/PhpReferenceCompatibility.php:374
Stack trace:
#0 /MySite/vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject/PhpReferenceCompatibility.php(414): Zend\\Stdlib\\ArrayObject\\PhpReferenceCompatibility->setIteratorClass(NULL)
#1 [internal function]: Zend\\Stdlib\\ArrayObject\\PhpReferenceCompatibility->unserialize('a:4:{s:7:"stora...')
#2 /MySite/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php(95): session_start()
#3 /MySite/vendor/zendframework/zendframework/library/Zend/Session/AbstractContainer.php(78): Zend\\Session\\SessionManager->start()
#4 /MySite/module/Application/Module.php(97): Zend\\Session\\AbstractContainer->__construct('site')
#5 [internal function]: Application\\Module->onBootstrap(Object(Zend\\Mvc\\MvcEvent))
#6 /MySite/vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject/PhpReferenceCompatibility.php on line 374
Code Module.php line 97 :
$s_site = new \Zend\Session\Container('site');
I try but I can not find why. Do you have any idea? Need more informations?
Thank you.
The is a result of the setIteratorClass method in ArrayObject/PhpReferenceCompatibility being passed a null $class argument. I'm not sure why it sometimes gets a null, but the way I fixed it in my case was to set the iterator class as 'ArrayIterator' when passed a null object, like this:
if (!isset($class)) {
$class = 'ArrayIterator';
}
In the latest zf2 version, the ArrayObject/PhpReferenceCompatibility class has been removed, so please make the change in stdlib/ArrayObject.php.

Integrating Search-SphinxsearchBundle into Symfony

I'm using Symfony-standard,
I have installed Search-SphinxsearchBundle
I was assuming, i would use it's services in controller, to fetch documentation in my app/Resources/docs, where there's index.srt, I need to know how to direct the bundle to search from my folder.
I want to use it to query my index.srt documentations in app/Resources/docs.
I'm stuck on app/config/config.yml
sphinxsearch:
indexes:
- name: books
index:
- %sphinxsearch_index_books%
field_weights:
label: 10
content: 5
I'm getting this error:
Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException'
with message 'You have requested a non-existent parameter "sphinxsearch_index_pages".'
in /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:108 Stack trace:
#0 /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(234): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get('sphinxsearch_in...')
#1 /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(205): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveString('%sphinxsearch_i...', Array)
#2 /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(195): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue('%sphinxsearch_i...', Array)
#3 /usr/local/dev/hris/vendo in /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 108

Zend Framework Create Custom View Helper?

I have tried multiple fixes but none have worked. I am getting this error:
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception'
with message 'Plugin by name 'AddCss' was not found in the registry;
used paths: Zend_View_Helper_:
Zend/View/Helper/:/Users/cgunnels/dev/git/rove-git/application/views/helpers/'
in
/usr/local/zend/share/ZendFramework/library/Zend/Loader/PluginLoader.php:412
Stack trace: #0
/usr/local/zend/share/ZendFramework/library/Zend/View/Abstract.php(1182):
Zend_Loader_PluginLoader->load('AddCss') #1
/usr/local/zend/share/ZendFramework/library/Zend/View/Abstract.php(618):
Zend_View_Abstract->_getPlugin('helper', 'addCss') #2
/usr/local/zend/share/ZendFramework/library/Zend/View/Abstract.php(344):
Zend_View_Abstract->getHelper('addCss') #3
/Users/cgunnels/dev/git/rove-git/application/layouts/scripts/layout.phtml(6):
Zend_View_Abstract->__call('addCss', Array) #4
/Users/cgunnels/dev/git/rove-git/application/layouts/scripts/layout.phtml(6):
Zend_View->addCss(Array) #5
/usr/local/zend/share/ZendFramework/library/Zend/View.php(108):
include('/Users/cgunnels...') #6 /usr in
/usr/local/zend/share/ZendFramework/library/Zend/Controller/Plugin/Broker.php
on line 336
this is my class:
class Zend_View_Helper_Css extends Zend_View_Helper_Abstract {
public function css() {
die("test");
}
}
I followed the instructions on this page http://framework.zend.com/manual/en/zend.view.helpers.html and it doesn't work.
I also added this to my application.ini:
resources.view.helperPath = APPLICATION_PATH "/views/helpers"
Please help me out, thanks
answer provided by author:
I fixed it. So the filename was CssHelper.php I changed it to Css.php
and it worked. – chris gunnels

Categories