Page 2 of 2

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 05 Oct 2013, 17:31
by louis67
Hi I've the same problem with the 3.0.2

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 05 Oct 2013, 19:17
by Hoffi
Hi,

I made some experiments and found the cause! :twisted:

PhocaDownload 3.0.2 is the first version using schema update in xml file. This means that there is no entry in Joomla's schemas table. So the installer is not willing to execute the given 3.0.2.sql file, but add an entry to schemas table with version 3.0.2. So installing this version again does also not execute 3.0.2.sql (which is correct in that case).

This means: If the very first version ever of an extension doesn't have a schema update block in their xml it should never have one! :x

Now I understand why most other extensions use an install script and update the tables from this script...

(validated by changing version_id in schemas table to 3.0.1 after first update and than update again to 3.0.2 - works fine now)

Hoffi

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 06 Oct 2013, 04:47
by jrthor2
When I look at the sql that is in the 3.0.2 download, I don't see any alter commands. Where are they, or what are they so I can run them and fix this?

Thanks

UPDATE: I did the database trick, changing the Joomla schema's table to 3.0.1 and upating again, and it worked.

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 09 Oct 2013, 22:20
by Jan
Ok

(schemas are stored in ZIP / update/sql/mysql )


Hoffi
Yes, this is a common problem of checking the column in table - there is no such rule for mysql so such is better to do per script (to find the missing columns and then add them if they are not included).

There is an option to do it per sql:

Code: Select all

-- BEGIN PROCEDURE
-- DELIMITER $$
-- CREATE PROCEDURE AlterTable()
-- BEGIN
--     DECLARE _count INT;
-- 	DECLARE _count2 INT;
-- 	
--    SET _count = ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '#__phocadownload' AND COLUMN_NAME = 'token' );
--    IF _count = 0 THEN ALTER TABLE `#__phocadownload` ADD COLUMN `token` char(64) default NULL;
-- 	END IF;
-- 	
--     SET _count2 = ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '#__phocadownload' AND COLUMN_NAME = 'tokenhits' );
--     IF _count2 = 0 THEN ALTER TABLE `#__phocadownload` ADD COLUMN `tokenhits` int(11) NOT NULL default 0;
-- 	END IF;
-- END $$
-- DELIMITER ;
-- CALL AlterTable();
-- DROP PROCEDURE IF EXISTS AlterTable;
-- END PROCEDURE
But such sql cannot be run in joomla as it is stripped :-(

Running own php script is not a solution too :-( because not all new install/update rules will be followed (but such should be a question for joomla developers) ... I have tested it with many options and yes, if the item is stored in schema table in Joomla! then it is really hard to correct the installation :-( :-(

Jan

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 11 Oct 2013, 04:00
by schlogo
Hello

Got exactly the same error after the update to 3.0.2. running the slq file with the right prefix fixed it ! . Definitively something going on with the component

Tks for the solution
Hoffi wrote:Hi,

after upgrading from 3.0.1 to 3.0.2 I got SQL-Error (1054) too. This is caused by the new fields 'token' and 'tokenhits' in phocadownload table.
I had seen your intention to alter table with your update file 3.0.2.sql. But something seems to go wrong.
Maybe it's the "mysql"? Our site is configured to "MySQLi", not "MySQL". But this is only an idea - I'm not sooo familiar with Joomla's code.

After execution of the two "ALTER..." lines from 3.0.2.sql (replacing "#_" by real table prefix) directly in phpmyadmin all works fine.

Maybe this helps a bit,
Hoffi

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 02 Nov 2013, 20:35
by gray
Hoffi, thank you! Confirm it works.
So:
- install 3.0.2
- with phpMyAdmin open _schemas table in your database
- find record with corresponds to PD extension ID, you can find it in _extensions table, or if there is only one recored with version_id = 3.0.2 it should be PD
- change 3.0.2 to 3.0.1
- install again

Alternatively, you can add manually record to _schemas (put version id = 3.0.1) before first install of 3.0.2 Just tested Ok!

It works even if MySQLi database is used. In any case for me it worked Ok.

PS. I also managed to add styles and log tables in this way. Content of my 3.0.2.sql file:

Code: Select all

ALTER TABLE `#__phocadownload` 
ADD COLUMN `token` char(64) default NULL AFTER `unaccessible_file`, 
ADD COLUMN `tokenhits` int(11) NOT NULL default 0 AFTER `token`;

CREATE TABLE IF NOT EXISTS `#__phocadownload_styles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL DEFAULT '',
  `alias` varchar(255) NOT NULL DEFAULT '',
  `filename` varchar(255) NOT NULL DEFAULT '',
  `menulink` text,
  `type` tinyint(1) NOT NULL DEFAULT '0',
  `published` tinyint(1) NOT NULL DEFAULT '0',
  `checked_out` int(11) unsigned NOT NULL DEFAULT '0',
  `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ordering` int(11) NOT NULL DEFAULT '0',
  `params` text,
  `language` char(7) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8 ;

INSERT INTO `#__phocadownload_styles` (`id`, `title`, `alias`, `filename`, `menulink`, `type`, `published`, `checked_out`, `checked_out_time`, `ordering`, `params`, `language`) VALUES
(1, 'Phocadownload', 'phocadownload', 'phocadownload.css', NULL, 1, 1, 0, '0000-00-00 00:00:00', 1, NULL, '*'),
(2, 'Rating', 'rating', 'rating.css', NULL, 1, 1, 0, '0000-00-00 00:00:00', 2, NULL, '*'),
(3, 'Button', 'button', 'button.css', NULL, 1, 0, 0, '0000-00-00 00:00:00', 3, NULL, '*'),
(4, 'Button (Rounded Corners)', '', 'buttonrc.css', NULL, 1, 0, 0, '0000-00-00 00:00:00', 4, NULL, '*'),
(5, 'Default', 'default', 'default.css', NULL, 2, 1, 0, '0000-00-00 00:00:00', 1, NULL, '*'),
(6, 'Bootstrap', '', 'bootstrap.min.css', NULL, 1, 0, 0, '0000-00-00 00:00:00', 5, NULL, '*');

CREATE TABLE IF NOT EXISTS `#__phocadownload_logging` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `fileid` int(11) NOT NULL default '0',
  `catid` int(11) NOT NULL default '0',
  `userid` int(11) NOT NULL default '0',
  `ip` varchar(20) NOT NULL default '',
  `page` varchar(255) NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `type` tinyint(1) NOT NULL DEFAULT '0',
  `params` text NOT NULL,
  PRIMARY KEY  (`id`)
) DEFAULT CHARSET=utf8;

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 08 Dec 2013, 23:56
by Jan

Re: upgraded to 3.0.2 for Joomla 3.1.5, can't get to page no

Posted: 04 Mar 2014, 09:09
by Artemio
Works perfectly...

Thanks!!!!