TM-FORUM

The TrackMania universal forum ^_^
It is currently 27 Apr 2017 21:40

All times are UTC + 1 hour




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: [SOLVED] [XASECO1] MySql connection syntax
PostPosted: 04 Dec 2016 22:02 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
Hi all,

I'm trying to configure Xaseco1 for TMNF under Ubuntu 16.04 LTS - PHP 7.

Unfortunately, i had a 1st problem with mysql_connect into

Code:
../xaseco/plugins/plugin.localdatabase.php


I have changed all mysql_ with mysqli_ however now i have this error :

Code:
[PHP Warning] mysqli_select_db() expects exactly 2 parameters, 1 given on line 77 in file ../xaseco/plugins/plugin.localdatabase.php


So, what's the correct syntax of this ?

Code:
if (!mysqli_select_db($ldb_settings['mysql']['database'])) {
                trigger_error('[LocalDB] Could not find MySQL database!', E_USER_ERROR);
        }


... or, is there a more recent version to be used under php7 ?

... or, another controller ?

Thanks for tips...


Last edited by Adgenodux on 22 Dec 2016 20:21, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 05 Dec 2016 09:39 
Offline
Pit Crew
Pit Crew

Joined: 19 Aug 2007 13:58
Posts: 5631
Owned TM-games: TMN, TMU, TMF, TM²
Adgenodux wrote:
... or, is there a more recent version to be used under php7 ?

No.

Adgenodux wrote:
... or, another controller ?

Controllers aplenty but most if not all using MySQL will have the same problem on PHP7.

Adgenodux wrote:
Thanks for tips...

Port this to X1.

_________________
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub


Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 05 Dec 2016 18:32 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
Hi Xymph and thanks for your reply...

Thanks for the nice tip Modernizer, looks like it works natively with X1, however i've got some errors, even if it seems working partially (i've got the Xaseco and dedimania start messages into TM and the extra console commands however no widget displayed and some errors in logfile, supposed related to Modernizer)

But i've got a question for you...

How can i see in my OS console if Xaseco is running as i can't see nothing about into htop ? Previously, Manialive was into the processes list and as i've launched Xaseco many times during tests, can it be launched multiple times for same server and how to see it into proccesses ?

Thanks for infos...


Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 05 Dec 2016 21:18 
Offline
Pit Crew
Pit Crew

Joined: 19 Aug 2007 13:58
Posts: 5631
Owned TM-games: TMN, TMU, TMF, TM²
Adgenodux wrote:
How can i see in my OS console if Xaseco is running as i can't see nothing about into htop ?

Code:
ps ax | grep php

Adgenodux wrote:
Previously, Manialive was into the processes list and as i've launched Xaseco many times during tests, can it be launched multiple times for same server and how to see it into proccesses ?

Don't know, that sentence doesn't parse in English. ;)

_________________
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub


Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 05 Dec 2016 22:09 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
this

Code:
ps ax | grep php


... will answer to my questions...

thx :mrgreen:


Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 14 Dec 2016 14:34 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
well,

Now with Modernizer, the functions are working correctly but it looks like i have a small sql query issue.

So after initialization, i've got this :

Code:
###############################################################################
  XASECO v1.16 running on 127.0.0.1:5010
  Name   : Test Server - My_TM_server
  Game   : TmForever United - Stadium - TimeAttack
  Version: 2.11.26 / 2011-02-21
  Authors: Florian Schnell & Assembler Maniac
  Re-Authored: Xymph
###############################################################################
Begin Challenge
[XASECO Warning] Could not get challenge info! (Unknown column 'r.ChallengeId' in 'on clause')
sql = SELECT c.Id AS ChallengeId, r.Score, p.NickName, p.Login, r.Date, r.Checkpoints
                  FROM challenges c
                  LEFT JOIN records r ON (r.ChallengeId=c.Id)
                  LEFT JOIN players p ON (r.PlayerId=p.Id)
                  WHERE c.Uid='xx_xxxxxxxxxxxxxxxxxxxxxxxxxx'
                  GROUP BY r.Id
                  ORDER BY r.Score ASC,r.Date ASC
                  LIMIT 50
[12/14,14:12:24] track changed [undefined] >> [MY_TM_server]
[12/14,14:12:24] currently no record on MY_TM_server


Into db, i only have one entry into challenges table, no rows into other tables...

So, could it be because there are no records yet and it will solve hitself after some recorded datas or is it a query syntax error ?

Thanks for help...


Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 22 Dec 2016 17:09 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
Well,

After a search time and comments into the developpez.net mysql section, the problem could be related to missing colums to make jonctions between tables...

Below is the plugin.localdatabase.php main tables creation process so could someone tell me how adding missing parts ?

Code:
// create main tables
        $query = "CREATE TABLE IF NOT EXISTS `challenges` (
                    `Id` mediumint(9) NOT NULL auto_increment,
                    `Uid` varchar(27) NOT NULL default '',
                    `Name` varchar(100) NOT NULL default '',
                    `Author` varchar(30) NOT NULL default '',
                    `Environment` varchar(10) NOT NULL default '',
                    PRIMARY KEY (`Id`),
                    UNIQUE KEY `Uid` (`Uid`)
                  ) ENGINE=MyISAM";
        mysql_query($query);

        $query = "CREATE TABLE IF NOT EXISTS `players` (
                    `Id` mediumint(9) NOT NULL auto_increment,
                    `Login` varchar(50) NOT NULL default '',
                    `Game` varchar(3) NOT NULL default '',
                    `NickName` varchar(100) NOT NULL default '',
                    `Nation` varchar(3) NOT NULL default '',
                    `UpdatedAt` datetime NOT NULL default '0000-00-00 00:00:00',
                    `Wins` mediumint(9) NOT NULL default 0,
                    `TimePlayed` int(10) unsigned NOT NULL default 0,
                    `TeamName` char(60) NOT NULL default '',
                    PRIMARY KEY (`Id`),
                    UNIQUE KEY `Login` (`Login`),
                    KEY `Game` (`Game`)
                  ) ENGINE=MyISAM";
        mysql_query($query);

        $query = "CREATE TABLE IF NOT EXISTS `records` (
                    `Id` int(11) NOT NULL auto_increment,
                    `ChallengeId` mediumint(9) NOT NULL default 0,
                    `PlayerId` mediumint(9) NOT NULL default 0,
                    `Score` int(11) NOT NULL default 0,
                    `Date` datetime NOT NULL default '0000-00-00 00:00:00',
                    `Checkpoints` text NOT NULL,
                    PRIMARY KEY (`Id`),
                    UNIQUE KEY `PlayerId` (`PlayerId`,`ChallengeId`),
                    KEY `ChallengeId` (`ChallengeId`)
                  ) ENGINE=MyISAM";
        mysql_query($query);

        $query = "CREATE TABLE IF NOT EXISTS `players_extra` (
                    `playerID` mediumint(9) NOT NULL default 0,
                    `cps` smallint(3) NOT NULL default -1,
                    `dedicps` smallint(3) NOT NULL default -1,
                    `donations` mediumint(9) NOT NULL default 0,
                    `style` varchar(20) NOT NULL default '',
                    `panels` varchar(255) NOT NULL default '',
                    PRIMARY KEY (`playerID`),
                    KEY `donations` (`donations`)
                  ) ENGINE=MyISAM";
        mysql_query($query);


Thanks for help...


Top
 Profile  
 
 Post subject: Re: [XASECO1] MySql connection syntax
PostPosted: 22 Dec 2016 20:20 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
well,

finaly solved with the help of developpez.net community...

was a db corruption (missing some columns, invalid default date format and missing Id auto-increment) so erased than manualy rebuilt one by one throw phpmyadmin challenges, players, records and rs_x tables using sql files provided with Xaseco, modified the date and datetime default values to "1000-01-01 00:00:00" and now it runs...


Top
 Profile  
 
 Post subject: Re: [SOLVED] [XASECO1] MySql connection syntax
PostPosted: 23 Dec 2016 09:50 
Offline
Pit Crew
Pit Crew

Joined: 19 Aug 2007 13:58
Posts: 5631
Owned TM-games: TMN, TMU, TMF, TM²
Glad to hear it wasn't something in the code. :thumbsup:

_________________
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub


Top
 Profile  
 
 Post subject: Re: [SOLVED] [XASECO1] MySql connection syntax
PostPosted: 23 Dec 2016 11:19 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
sure... :mrgreen:

however, maybe you could just warn somewhere that from mysql version 5.7, strict mode affects whether the server permits '0000-00-00' as a valid date...

so default date/datetime format could needs to be changed to "1000-01-01 00:00:00" or STRICT_TRANS_TABLES mode disabled (see http://stackoverflow.com/questions/3637 ... r-datetime) to avoid problems...

btw, very nice tool Xaseco, gj man :thumbsup:

unfortunately, many third-parties plugins appear outdated...


Top
 Profile  
 
 Post subject: Re: [SOLVED] [XASECO1] MySql connection syntax
PostPosted: 23 Dec 2016 17:10 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
Into the developpez.net thread, someone is talking about the REFERENCE CONSTRAINT type to avoid, i.e, to insert ChallengeId or PlayerID into RECORDS without link into CHALLENGE or PLAYER, or keeping id's that not exist into tables anymore... question of db integrity...

He has posted this:

Code:
CREATE TABLE IF NOT EXISTS
       `records` (`Id`          int(11)      NOT NULL auto_increment,
                  `ChallengeId` mediumint(9) NOT NULL default 0,
                  `PlayerId`    mediumint(9) NOT NULL default 0,
                  `Score`       int(11)      NOT NULL default 0,
                  `Date`        datetime     NOT NULL default '0000-00-00 00:00:00',
                  `Checkpoints` text         NOT NULL,
                  PRIMARY KEY (`Id`), 
                  UNIQUE  KEY `PlayerId` (`PlayerId`,`ChallengeId`),
                  KEY         `ChallengeId` (`ChallengeId`)
                  CONSTRAINT `fk1_challengid`
                              FOREIGN KEY (`ChallengeId`)
                              REFERENCES   `Challenge` (`id`)
                              ON UPDATE CASCADE
                              ON DELETE CASCADE
                  CONSTRAINT `fk2_playerid`
                              FOREIGN KEY (`PlayerId`)
                              REFERENCES   `Players` (`id`)
                              ON UPDATE CASCADE
                              ON DELETE CASCADE
                 )


what do you think about ?

should it be fixed ?


Top
 Profile  
 
 Post subject: Re: [SOLVED] [XASECO1] MySql connection syntax
PostPosted: 23 Dec 2016 22:19 
Offline
Pit Crew
Pit Crew

Joined: 19 Aug 2007 13:58
Posts: 5631
Owned TM-games: TMN, TMU, TMF, TM²
Adgenodux wrote:
what do you think about ?
should it be fixed ?

No idea, I ceased actively developing XAseco long ago, and am not familiar with those MySQL features / problems.

_________________
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub


Top
 Profile  
 
 Post subject: Re: [SOLVED] [XASECO1] MySql connection syntax
PostPosted: 24 Dec 2016 01:50 
Offline
pedestrian
pedestrian

Joined: 04 Dec 2016 21:52
Posts: 11
Owned TM-games: TMN TMU
damn...

thanks anyway... :-?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group