Fork me on GitHub

Announcement

The oneye project has been discontinued. You might not expect further fixes and support from us. All community related systems are set to read-only mode. Though feel free to download and use oneye as-is or even fork it over at GitHub.

#1 2011-09-13 12:18:25

MatBoy
Member
Registered: 2011-09-13
Posts: 27

MySQL integration > HOWTO's

Hi Guys,

I have the idea that MySQL for auth is more than wanted, so I'm figuring out if this is possible and actually I think we can by changing the loging script and some other. It seems to be doable as the functions are kinda straight that are used and can be redirected I think.

This is just a startpost for small howto's to change the code to interact with a MySQL DB. Small snippits are welcome and can be extended later on in their own topic or maybe a subforum ?

My start is, user registration and login against a MySQL DB, tips are welcome!

Offline

#2 2011-09-14 01:09:56

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: MySQL integration > HOWTO's

Hi MatBoy,

sure, this is possible - and should be quite easy to be integrated, too smile . Personally I don't need this, but the structure of oneye is flexible enough for such modifications.

  1. Copy eyeOSxxxxxxxxxx/system/services/um/modules/eyeos.eyecode and rename the new file to somewhat like mysql.eyecode.

  2. Change UM_MODULE in settings.php to the basename of the created file (e.g. mysql).

  3. Finally you'll "just" need to modify the created eyecode file to use mysql instead of xml files.

  4. I recommend to add um module specific constants in settings.php for the database url, port, user and password.

These changes might break some applications, but in case someone sends me a working um module, I'll go and fix these problems as they are reported.

Would you like to work on this?

In case you're interested: Do you know SVN and how to use it for development? In case you do, I'll grant you SVN access, so you'll get some more flexible.

PS: There might be some dead code in the oneye sources. Everyone is allowed to fix as many bugs as possible just as (s)he wants ;-) tongue xD (sorry, didn't know what smiley fits in best xD ).


Best regards,
Lars Knickrehm

The oneye project.

Offline

#3 2011-09-14 12:10:07

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

Hi Lars,

Thanks for your information, this is really worthfull!

I'm willing to help you guys out in this matter, the problem is that I have a complete rewrite of stuff in OnEye so I need to figure out if it's doable for me to seperate my differences from the orginal code and make it "modulair".

I know a little bit how SVN works, I need to dive into it again for my own dev too wink But I would like to have a way to see what differences I made to the original code... need to check that also.

I will ask a lot of questions here for my own dev and need to decide how I can extend it after i fixed my own stuff and place it back.

Let's hope I won't make a mess here by asking for my own dev and use your code too... it's just that's if difficult to maintain 2-3 version and work all the same wink

For the default project.. I'm here for you and will check into that part when I have my version setup here... man this is a great forum! Check out freenode @ #oneye too !

Offline

#4 2011-09-19 14:38:08

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

Has someone some more details on how to use eyeSimpleDB ?

I have this example but I can't get fully what happens there... there are no full docs either about simpleDB ?


 $params = array('host'=>'127.0.0.1','login'=>'test','password'=>'test','dbname'=>'test');
	$db = reqLib('eyeSimpleDb','newDb',$params);
	if(!$db){
		$error = errorCodes('getErrorCode');
		if($error == DB_NO_DRIVER){
			$GLOBALS['eyeString_TxtA2']->setText('No Driver disponible en eyeOS');		
		}elseif($error == DB_NO_SUPPORT){
			$GLOBALS['eyeString_TxtA2']->setText('No Driver disponible en php');
		}
	}		
	$query = 'SELECT * FROM news where title = ?';
	$params = array('query'=>$query,'values'=>array('\'foo\''));
	$query = reqLib('eyeSimpleDb','parseQuery',$params);
	
	$result = $db->query(array('query'=>$query,'type'=>'select'));

Offline

#5 2011-09-19 21:28:50

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: MySQL integration > HOWTO's

I don't know much about eyeSimpleDb. Better you write your own library for MySQL usage wink ...


Best regards,
Lars Knickrehm

The oneye project.

Offline

#6 2011-09-19 23:12:43

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

It might be indeed. Such a library doesn' t need to be that fancy as "Simple"DB

Offline

#7 2011-09-22 13:59:28

lucaferrario
Administrator
From: near Como, Italy
Registered: 2011-07-15
Posts: 91

Re: MySQL integration > HOWTO's

Just my 2 cents: never forgot that there are already a lot of beautiful PHP classes on sites like for example http://www.phpclasses.org wink

Offline

#8 2011-09-26 20:27:27

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

lucaferrario wrote:

Just my 2 cents: never forgot that there are already a lot of beautiful PHP classes on sites like for example http://www.phpclasses.org wink


Do you have a favorite one that you would have integrated ?

Offline

#9 2011-09-26 22:35:58

lucaferrario
Administrator
From: near Como, Italy
Registered: 2011-07-15
Posts: 91

Re: MySQL integration > HOWTO's

Nope, I never did any search about this... I use MySQL in some apps but I've always built simple custom functions.... But this because oneye has never done extensive use of MySQL.... If we plan to use it for logins and (as some other users suggested in the forum) for configurations & co, maybe we need to build an oneye MySQL class... (honestly, I don't feel the need to go for MySQL....but I can understand that it could be useful for some professional users wink )

Offline

#10 2011-09-27 13:21:54

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

My issue there is that we need to be on the same line with other people who want this.

So I suggest people, including you, what kind of class we will use, or what we might develop.

Some classes are too complex and that is not what we want... we actually want to use a simple query if needed.

Offline

#11 2011-09-27 13:57:54

lucaferrario
Administrator
From: near Como, Italy
Registered: 2011-07-15
Posts: 91

Re: MySQL integration > HOWTO's

I think that for the moment some simple functions like the following should be enough:

  • Connect

  • Disconnect

  • Execute select query

  • Execute insert query

  • Execute update query

  • Execute delete query

Then in the future we'll add more functions to the class, as we feel the need to.
So probably the best thing would be to write our own class, since it seems to be quite simple wink
Please use MySQLi instead of the obsolete MySQL wink

[EDIT]Come on IRC wink[/EDIT]

Last edited by lucaferrario (2011-09-27 14:02:41)

Offline

#12 2011-09-27 21:33:01

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

yeah true, PDO would be most nice... but MySQL is not obsolete... not fully smile

Offline

#13 2011-09-27 22:36:26

lucaferrario
Administrator
From: near Como, Italy
Registered: 2011-07-15
Posts: 91

Re: MySQL integration > HOWTO's

In fact I didn't mean PDO, which on some servers is not installed...I was talking about MySQLi, which is installed on every server that runs MySQL and is going to replace the old MySQL extension... wink
Also, on the PHP manual there is:

The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.
If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use the mysqli extension instead

Offline

#14 2011-10-10 10:48:51

MatBoy
Member
Registered: 2011-09-13
Posts: 27

Re: MySQL integration > HOWTO's

Anyone willing to talk about a standard for this ?

Offline

#15 2011-12-28 19:07:17

Steven
Member
From: Near Aix en Provence, France
Registered: 2011-07-19
Posts: 20
Website

Re: MySQL integration > HOWTO's

My 2 cents:
Would it not be MUCH easier to just redo the XML functions (8), so um will work with mysql.
I already did that once, will try to find the code and mail it here.

Cheers,
Steven


Steven Lobbezoo
[url=http://www.maisons-de-france.com]www.maisons-de-france.com[/url]

Offline

#16 2011-12-29 06:57:20

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: MySQL integration > HOWTO's

Actually that'd be the easiest way, yes wink ... You'd just need to create a new eyeXML module and register it in settings.php ...


Best regards,
Lars Knickrehm

The oneye project.

Offline

#17 2012-06-20 16:19:12

fasenderos
Member
Registered: 2012-05-18
Posts: 26

Re: MySQL integration > HOWTO's

Any news on mysql? Is it planned to integrate this function in future?

Thanks

Offline

#18 2012-06-20 16:47:48

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: MySQL integration > HOWTO's

Do you especially need an MySQL connection for your project?


Best regards,
Lars Knickrehm

The oneye project.

Offline

#19 2012-07-10 14:44:46

fasenderos
Member
Registered: 2012-05-18
Posts: 26

Re: MySQL integration > HOWTO's

lars-sh wrote:

Do you especially need an MySQL connection for your project?

I apologize for the delay, I did not see your answer

I'm using jFusion to integrate external software into Joomla...when a user is created/edited/deleted in Joomla, Jfusion store the user info(name, username, email, pwd) into the external software database...Probably is there a way to do the same thing with the xml file but i have no idea on how to do that.

thanks

Offline

#20 2012-11-03 10:54:15

Peter
Member
Registered: 2012-05-04
Posts: 54
Website

Re: MySQL integration > HOWTO's

lars-sh wrote:

Do you especially need an MySQL connection for your project?

Altho you do not seethe need of it. It will be a great improvement. I for myself need MYSQL for my project. I need it to connect it to another Database, and backup user-cofigurations in case of a crash. And i want to create Accounts automatically. The XML thing i do not understand but MYSQL would help a lot!

User management and group management would be improved. Businesses would consider using/switching to ONeye (they like databases). They mostly like the User Accounts on a different server at another country and mirrored. You still could let the user choose if they like MySQL or XML, but you should leave the idea that they can convert the XML to the Database and vice versa. I am not a programmer but i know it IS possible.

-Peter

Offline

#21 2012-11-08 13:54:54

Peter
Member
Registered: 2012-05-04
Posts: 54
Website

Re: MySQL integration > HOWTO's

MatBoy wrote:

Hi Lars,

Thanks for your information, this is really worthfull!

I'm willing to help you guys out in this matter, the problem is that I have a complete rewrite of stuff in OnEye so I need to figure out if it's doable for me to seperate my differences from the orginal code and make it "modulair".

I know a little bit how SVN works, I need to dive into it again for my own dev too wink But I would like to have a way to see what differences I made to the original code... need to check that also.

I will ask a lot of questions here for my own dev and need to decide how I can extend it after i fixed my own stuff and place it back.

Let's hope I won't make a mess here by asking for my own dev and use your code too... it's just that's if difficult to maintain 2-3 version and work all the same wink

For the default project.. I'm here for you and will check into that part when I have my version setup here... man this is a great forum! Check out freenode @ #oneye too !

may you help me with the mysql? i do not know how toc hange the code so it uses mysql and how the passwords wikll be saved correctly.

Offline

#22 2012-11-08 17:35:12

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: MySQL integration > HOWTO's

I realise I'm not MatBoy, but I thought I'd put forward a suggestion:

Before you start coding, have you given thought to how the tables in mySQL should be structured? Because I really think we should come up with a layout we (anyone interested in this) can all agree/come to a compromise on (ie. a Standard). Now, we do have a wiki (http://wiki.oneye-project.org/) perhaps you could head over there and start a page dedicated to this topic, and write out a basic database and tables structure. We can then discuss it in this thread, and modify the wiki page to reflect decisions.

Also, how familiar with mySQL are you? And are you signed up to github (where the oneye repository resides)?

*pauses to think*

Some time ago I posted this:

s0600204 wrote:

(That said, I have been thinking about the possibility of writing an abstraction layer into oneye that would permit admins to choose between using .xml and a database system for storing user configuration... but that's just conjecture at this point, and would require heavy modification to much of the underlying code.)

Perhaps its time for me to start looking into that. I was considering on doing so in the New Year anyway...

Offline

#23 2012-11-08 17:41:05

Peter
Member
Registered: 2012-05-04
Posts: 54
Website

Re: MySQL integration > HOWTO's

s0600204 wrote:

I realise I'm not MatBoy, but I thought I'd put forward a suggestion:

Before you start coding, have you given thought to how the tables in mySQL should be structured? Because I really think we should come up with a layout we (anyone interested in this) can all agree/come to a compromise on (ie. a Standard). Now, we do have a wiki (http://wiki.oneye-project.org/) perhaps you could head over there and start a page dedicated to this topic, and write out a basic database and tables structure. We can then discuss it in this thread, and modify the wiki page to reflect decisions.

Also, how familiar with mySQL are you? And are you signed up to github (where the oneye repository resides)?

*pauses to think*

Some time ago I posted this:

s0600204 wrote:

(That said, I have been thinking about the possibility of writing an abstraction layer into oneye that would permit admins to choose between using .xml and a database system for storing user configuration... but that's just conjecture at this point, and would require heavy modification to much of the underlying code.)

Perhaps its time for me to start looking into that. I was considering on doing so in the New Year anyway...

I'm not your boss but having it before 2013 and then make a new year release would surely bring users When i get home i will try to help organize and standardize it. (altho i am not a php programmer)

Offline

#24 2012-11-08 21:21:37

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: MySQL integration > HOWTO's

Hi all,

  1. There should be php constants in settings.php - just as we'd done it for LDAP support some time ago.

  2. In order to contribute to the oneye sources, just fork the repository at GitHub, commit your changes and request pulling those.

  3. Finally s0600204 is absolutely correct: Before starting DB related stuff, we really need to think of a well to handle DB, while I recommend to have a special field, that's still having xml or json encoded or even better - serialized data, that might be created from third parties in the previous structures. Or even better: maintaining both: XML files to keep at least reading support for older third parties, but copying some of those actions to the DB.

  4. s0600204, could you maintain this topic? I really like your work, but am just too busy this year to do things myself sad

Some more notes and explanations: I recommend you to copy the eyeos um module (system/um/modules/eeyos.eyecode) and rename it to db.eyecode. Additionally it'd be nice to be able to handle db drivers for MySQL, SQLite and so on. Those might be realized in a specific library.

Anything more to mention? We'll see wink ...


Best regards,
Lars Knickrehm

The oneye project.

Offline

#25 2012-11-10 01:31:11

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: MySQL integration > HOWTO's

Lars-sh wrote:

There should be php constants in settings.php - just as we'd done it for LDAP support some time ago.

I was considering attempting to do it in a way that would permit admins to choose their user config management system from eyeControl. That's part of the reasoning behind my abstraction layer idea.

Lars-sh wrote:

s0600204, could you maintain this topic? I really like your work

I can try. And thanks.

Peter wrote:

I'm not your boss but having it before 2013

I've started work on my abstraction-layer idea. Its proving to be easier to implement than I thought it would be. I'll try to get a usable version of it up on my oneye fork on Github soon.

Offline

Board footer

Powered by FluxBB