Macrotone Blogs

Macrotone blogs upon Joomla, our products and other matters.

An IT professional with a wide experience of IT systems, specialising in Database Management and Security.

Design Criteria for processing emailed issues

We have been busy with a forthcoming feature for our Issue Tracker, which is the ability to receive emails with details of new issues or emails containing updates to previously raised issues.

After much thought and consideration the following design criteria are  deemed necessary in the email issues functionality. They are included in no specific order of
priority.

Continue reading

Problems getting a front end wget/curl cron working.

joomlaIn completing the testing of our ‘cron’ addition to a Joomla component we experienced a small problem, which is worthy of noting especially as we have not seen any mention of the problem anywhere else on the web.

The problem manifested itself as the apparent ‘inactivity’ when a front end web page was accessed via wget, curl or lynx.  This was very puzzling since accessing via the usual web browser appeared to be working.  After much testing we discovered that wget, curl etc. were indeed accessing the page but the underlying actions that the page was intended to run were not occurring.

To cut a long story short, we discovered that the pages were being served up by the ‘page cache’.  In the normal course of events this is what one wants to occur, however with a ‘cron’ page we want the underlying actions to occur.  It was necessary to disable the caching of the specific accessed page and this completely resolved the problem.

What was interesting was that this specific problem was not mentioned on any sites on the web, despite extensive searches. Either everyone else is aware of the problem, possible but unlikely, or equally unlikely no-one else uses page caching.

As part of our investigations we also tried out a well known ‘free cron’ service.  This didn’t help us resolve our problem, but did make us aware of possible ‘redirections’ that may be caused by the use of ‘SEF’ components on a web site. It was necessary to specify the ‘redirection URL’ rather than the ‘original URL’ to the service. Not a specific problem but one of those things to be aware of. 

Problems installing a Joomla component

joomlaWe met a very strange problem when we had to re-install a third party Joomla component.  We will not go into the details of why we had to do a fresh re-install, sufficient to say it was to try and fix an ‘opportunity for improvement’.  We couldn’t uninstall using the standard Joomla mechanism because we wanted to retain all the underlying database tables used by the component so did a manual uninstall instead.

The component was quite large but we extracted all the files and placed them in the tmp directory, so it was easy to reinstall until we determined the cause of the problem.  [We encountered a few MySQL Error 2006 – DB Server has gone away’ messages, but apart from being annoying were not really causing a problem.]

The component ‘spun’ its icon and then presented us with the following messages:

"Component Install: DB function reports no errors"
"Error installing component"

In addition an entry was make in the #__extensions table but no files are ever installed.  It is impossible to remove it via the Joomla ‘Manage’ feature and all one can do is remove the entries from the table via phpadmin (or similar).

Attempts to re-install again, are repeatable and every time a new entry was inserted into #__extensions.  If one tried several times, several rows were created.

Then we found this problem report, which had all the symptoms we were seeing.  It was raised against Joomla 1.6 but was still very useful. The clue was the mention of the #__assets table and sure enough we found a single line entry in the #__assets table which we could then remove and the next attempt to reinstall worked perfectly.

Running scheduled (cron) tasks with Joomla

joomlaWe have recently developed a feature with one of our components to make use of a scheduled task to perform a repetitive action, which avoids the need for us to enter the site and manually click upon various icon(s) which in turn cause the required action(s) to occur. Such a requirement is reasonably common and includes things such as sending scheduled emails etc. We were expecting it to be difficult to implement but as it turned out was pleasantly easy to achieve.

Upon UNIX based systems ‘Cron’ is a daemon that provides a time-based job scheduler that runs in the  background on UNIX systems that executes commands at specified intervals. These commands are called "cron jobs."  Windows servers use a Scheduled Task to  execute commands. Typically a task requiring repetitive actions  to be carried out on a regular (pre-determined) basis would be ideal candidates for using ‘cron’.

There are basically a few methods that can be used to provide a  scheduled task within Joomla. The preferred method will depend upon the specific web hosting supplier and the facilities they supply. [For our implementation it was necessary to supply both mechanisms, since some of our users’ systems may not have one or the other.]

Continue reading

reCAPTCHA updated by Google

We have noticed recently that on some sites, that Google’s reCAPTCHA have included a number of numeric challenges instead of characters. We didn’t take much interest at the time but mentally noted it.

Google has today rolled out an updated version of its reCAPTCHA system.  We first saw the details herereCAPTCHA is a user-dialogue system originally developed by Luis von Ahn, Ben Maurer, Colin McMillen, David Abraham and Manuel Blum at Carnegie Mellon University's main Pittsburgh campus, and acquired by Google in September 2009. CAPTCHA stands for “Completely Automated Public Turing test to tell Computers and Humans Apart”, and as its name implies, it is a quick test used in computing to determine whether or not the user is human, and one has probably seen it many times on different sites, and we even use it upon our own, however we still seem to be displaying character strings.

http://techglam.com/wp-content/uploads/2013/10/reCAPTCHA.jpg

Generally reCAPTCHA  presents two words (and the term words is used loosely): one which it knows (used to test whether you are human), and one which it doesn’t (used to help digitize the text in books). Since humans find numeric CAPTCHAs (pictured above) significantly easier to solve than those containing arbitrary text, Google will be showing you more and more numbers, which explains our observations. So we can expect to see it more often.

Using an IDE for Joomla development

phpstormWe have never really taken to using an Integrated Development Environment tool (IDE) for product development.  This is nothing against IDE’s per se, just that over the years we have used a lot of tools, some good, some bad, and have found that just when one starts getting productive with them, they suddenly stop being supported.  We could name (but won’t) numerous tools that fall into that category.  A lot end up being taken over by a certain well known ‘computer software vendor’ who then milks them for the support fees, but never develops them, before finally dropping them. This then leave one ‘high and dry’ and forced to change to another tools.

Continue reading

Changing Joomla MySQL database connection details

mysqlWe recently had cause to have to modify the connection details that a Test Joomla setup was using to connect to the underlying database.  The reason was that we wanted to test out a component installation where some specific database privileges had not been granted.

In out case we were interested in the database privileges ‘CREATE VIEW’, ‘CREATE ROUTINE’ and ‘TRIGGER’. Since our component would make use of database triggers, procedures and views we needed to test out an installation on a system where such grants were not present.

Our systems had the required privileges granted and we knew that editing the ‘configuration.php’ file in the existing Joomla installation should enable us to achieve this easily, but despite our attempts this wouldn’t work and instead gave us an error: ‘Database connection error (3): Could not connect to database ‘.

We played with the username and password settings in the ‘configuration.php’ file without any success it just wouldn’t connect and we knew that we had another database set up with the same username and password.

Then we remembered that we had only granted permissions for this ‘restricted’ database account to a specific database.  All we had to do was ensure that the correct grants were made for our 'second database’.

   1:  CREATE USER 'test'@'localhost' IDENTIFIED BY 'password';           -- Not required if the user already exists.
   2:  GRANT SELECT, INSERT, UPDATE, DELETE ON DBX.* TO 'test'@'localhost';
   3:  CREATE USER 'test'@'%' IDENTIFIED BY 'password';                    -- Not required if the user already exists.
   4:  GRANT SELECT, INSERT, UPDATE, DELETE ON DBX.* TO 'test'@'%';
   5:   
   6:  GRANT LOCK TABLES, CREATE TEMPORARY TABLES, CREATE, DROP, INDEX, ALTER ON DBX.* TO 'test'@'localhost';
   7:  GRANT LOCK TABLES, CREATE TEMPORARY TABLES, CREATE, DROP, INDEX, ALTER ON DBX.* TO 'test'@'%';

 

Where test is the name of your connection user, password is whatever your desired password is, and DBX is the name of your MySQL database.  Obviously if your database is not on your localhost you need to modify it for the appropriate host name or IP address, which ever is most apt.

Once we had done this it all worked perfectly and our testing could commence.

A new Audit tool for Joomla

auditAbout a week ago we released a new component for Joomla named JAudit.

Running upon Joomla 2.5 and Joomla 3.x this is a comprehensive auditing component that makes use of the underlying database to log changes made to the Joomla tables. It does not require any changes to Joomla core code and should work without impacting any Joomla functionality. The component requires that the system has been granted the appropriate database privilege to create database triggers.

We have long believed that if you are using a fully featured database upon your Joomla site it seems ‘silly’ to not make use of the features that the database provides.  Databases these days are very feature rich and it is only necessary to look at the possibilities of these features to realise just how much one is missing out upon. One analogy that brings this home, might be ‘Would you pay for a Ferrari and only drive it around in first gear?’

Continue reading

Debugging PHP with Java console.

b2ap3 thumbnail joomlaIt may seem a strange title for a blog, but we have been looking at a small ‘opportunity’ in converting one of our components to Joomla 3.x.

First a brief explanation is required. The module in question is a PHP module which calls some Javascript code which in turn then calls a separate PHP routine.  The error we were trying to resolve involved this ‘second’ PHP routine.  The module was designed to display a Google map and the first PHP module sets up the display, the Javascript code builds up the required map and it is in turn, populated with data obtained from the database and formatted by the second PHP routine.

This ‘inner’ PHP routine was working perfectly on Joomla 2.5 but on Joomla 3.1 only the map itself was displayed, not the 'map points’.  It was apparent therefore that there must be ‘code’ that was not Joomla 3.x compatible but how to find it.  Code inspection did not reveal any apparent cause. The changes to remove JRequest and replace it with JInput were working fine, and attempts to use print, dump, enqueueMessage, etc. statements were accepted but would never display any information which one could see.  [This might possibly be due to our trying to display text ‘after’ the ‘error point’, but am not totally convinced yet.] Inspection of error logs also were not informative, mainly it is suspected due to the Javascript ignoring the errors and proceeding to execute even after receiving a error from the PHP routine.

Continue reading

Emailing €˜items€™ with relative image URLs from Joomla.

issues-48We have been looking at a small ‘opportunity’ which we discovered when we were emailing material such as an ‘article’ or Issue Tracker ‘issue’ from our Joomla system.

The problem is quite simple to explain since it can be caused by the content editor that is forced to use relative URLs.

This can be resolved by creating a new profile in the editor (such as JCE) which is configured to use absolute urls and then assign the profile to the particular component where absolute URLs are needed.

There is a small note on it for JCE which explains how to do this in more detail.

Continue reading
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries