there is not an easy way to change aiki_config options from config.php

Reported by rejon on 2012-02-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
aikiframework
Critical
rg1024

Bug Description

It is totally silly and laborious that the path to moving an aiki site involved dumping the database and then hand editing the aiki_config table that is serialized data, or doing this from mysql client.

We need a simple way like in wordpress to do:

set_config('url', 'http://somesite.com/');

and be able to run this from a config.php file once, so we can update a site rather than the alternative.

Could we get this done for this 0.9.0 release? I can't stand doing this anymore and some way to set all the aiki_config options from the config.php would be supervaluable override. Wordpress can do this, and we should be able to do it to!

rg1024, what do you think? Is there a good simple way to get this done now and then be compatible with your config class work coming up?

rejon (rejon) wrote :

In the code in config.php there is:

function config_set($setting, $dvalue) {}

Could we do at the top of config.php

config_set('url', 'http://somesite.com/');

Then once reload the site, this field is saved in the database, then remove that line?

That would save a lot of time!

OR:

$aiki->config->set('url');

We need a solution now...it really takes too much time all this dumping, and hand tweaking.

$config is not overwritten by database.
see aiki.php line 149 (1); $config = $config + $temp..

to understand make this in php
$config["url"]="ok";
$temp["url"]="bad";
$config = $config + $temp;
echo $config["url"];

So, put config["url"] =..something, in config.php ...

is it working?

(1) for one time we have a generous comments, and you don't read it ;-)

rejon (rejon) wrote :

I'm testing now :)

On Mon, Feb 6, 2012 at 10:18 PM, rg1024 <email address hidden> wrote:
> $config is not overwritten by database.
> see aiki.php line 149 (1); $config = $config + $temp..
>
> to understand make this in php
> $config["url"]="ok";
> $temp["url"]="bad";
> $config = $config + $temp;
> echo $config["url"];
>
> So, put config["url"] =..something, in config.php ...
>
> is it working?
>
> (1) for one time we have a generous comments, and you don't read it ;-)
>
> --
> You received this bug notification because you are a member of
> Fabricatorz Developers, which is subscribed to aikiframework 0.9.0.
> https://bugs.launchpad.net/bugs/927527
>
> Title:
>  there is not an easy way to change aiki_config options from config.php
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions

--
Jon Phillips 王✳爻气 http://fabricatorz.com ✳ skype: kidproto ✳ irc: rejon
+1.415.830.3884 (global) ✳ +86-187-1003-9974 (beijing)

I'm wonder why Aiki how url can't we just pull that info from $_SERVER
like that (It should work)

 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://' .
 $_SERVER['HTTP_HOST'] . (['SERVER_PORT'] != 80 ? ':' .
 ['SERVER_PORT'] : '') .
 preg_replace("/" . basename($_SERVER['PHP_SELF']) . "$/", "",
 $_SERVER['PHP_SELF'])

in this case it will work if it's on https and different port.
I don't know wordpress but did you need to change url of the site if
you know where the index.php file is located? If I have file index.php
in server.com/foo/bar/baz/ if I set url to server.com will it be
working? If Aiki work only if url is set to the path where index.php
file is located then why we need $config['url'].

On Mon, 06 Feb 2012 10:14:06 -0000
rejon <email address hidden> wrote:

> In the code in config.php there is:
>
> function config_set($setting, $dvalue) {}
>
> Could we do at the top of config.php
>
> config_set('url', 'http://somesite.com/');
>
> Then once reload the site, this field is saved in the database, then
> remove that line?
>
> That would save a lot of time!
>
> OR:
>
> $aiki->config->set('url');
>
> We need a solution now...it really takes too much time all this
> dumping, and hand tweaking.
>

--
Jakub Jankiewicz
twitter: @jcubic
www: http://jcubic.pl

2012/2/6 Jakub Jankiewicz <email address hidden>

> I'm wonder why Aiki how url can't we just pull that info from $_SERVER
> like that (It should work)
>

i don't know. Wordpress has this disadvantage. Drupal and joomla no. In
Drupal base url is calculated by
...
$base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ?
'https' : 'http';

    // As $_SERVER['HTTP_HOST'] is user input, ensure it only contains
    // characters allowed in hostnames.
    $base_url = $base_root .= '://'. preg_replace('/[^a-z0-9-:._]/i', '',
$_SERVER['HTTP_HOST']);

    // $_SERVER['SCRIPT_NAME'] can, in contrast to $_SERVER['PHP_SELF'], not
    // be modified by a visitor.
    if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
      $base_path = "/$dir";
      $base_url .= $base_path;
      $base_path .= '/';
    }
    else {
      $base_path = '/';
    }
.....
So in aiki, perhaps it can be:
$config["url"] =
    'http' . ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=="on" ? 's' :
'') . '://' .
    $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' .
$_SERVER['SERVER_PORT'] : '') .
    preg_replace("/" . basename($_SERVER['SCRIPT_NAME']) . "$/", "",
$_SERVER['SCRIPT_NAME']);

Jakub Jankiewicz (jcubic) wrote :

I thought that $_SERVER['HTTPS'] is true or false. We should use your
code in Aiki, I don't see the reason why to use $config['url'].

On Mon, 6 Feb 2012 18:37:25 +0100
Roger Martín <email address hidden> wrote:

> 2012/2/6 Jakub Jankiewicz <email address hidden>
>
> > I'm wonder why Aiki how url can't we just pull that info from
> > $_SERVER like that (It should work)
> >
>
> i don't know. Wordpress has this disadvantage. Drupal and joomla no.
> In Drupal base url is calculated by
> ...
> $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ?
> 'https' : 'http';
>
> // As $_SERVER['HTTP_HOST'] is user input, ensure it only contains
> // characters allowed in hostnames.
> $base_url = $base_root .= '://'. preg_replace('/[^a-z0-9-:._]/i',
> '', $_SERVER['HTTP_HOST']);
>
> // $_SERVER['SCRIPT_NAME'] can, in contrast to
> $_SERVER['PHP_SELF'], not // be modified by a visitor.
> if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
> $base_path = "/$dir";
> $base_url .= $base_path;
> $base_path .= '/';
> }
> else {
> $base_path = '/';
> }
> .....
> So in aiki, perhaps it can be:
> $config["url"] =
> 'http' . ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=="on" ?
> 's' : '') . '://' .
> $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' .
> $_SERVER['SERVER_PORT'] : '') .
> preg_replace("/" . basename($_SERVER['SCRIPT_NAME']) . "$/", "",
> $_SERVER['SCRIPT_NAME']);

--
Jakub Jankiewicz
twitter: @jcubic
www: http://jcubic.pl

Great please try! Lets simplify aiki where possible. I want to gut the old
updater today and its options.

On Tuesday, February 7, 2012, Jakub Jankiewicz <email address hidden>
wrote:
> I thought that $_SERVER['HTTPS'] is true or false. We should use your
> code in Aiki, I don't see the reason why to use $config['url'].
>
>
> On Mon, 6 Feb 2012 18:37:25 +0100
> Roger Martín <email address hidden> wrote:
>
>> 2012/2/6 Jakub Jankiewicz <email address hidden>
>>
>> > I'm wonder why Aiki how url can't we just pull that info from
>> > $_SERVER like that (It should work)
>> >
>>
>> i don't know. Wordpress has this disadvantage. Drupal and joomla no.
>> In Drupal base url is calculated by
>> ...
>> $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ?
>> 'https' : 'http';
>>
>> // As $_SERVER['HTTP_HOST'] is user input, ensure it only contains
>> // characters allowed in hostnames.
>> $base_url = $base_root .= '://'. preg_replace('/[^a-z0-9-:._]/i',
>> '', $_SERVER['HTTP_HOST']);
>>
>> // $_SERVER['SCRIPT_NAME'] can, in contrast to
>> $_SERVER['PHP_SELF'], not // be modified by a visitor.
>> if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
>> $base_path = "/$dir";
>> $base_url .= $base_path;
>> $base_path .= '/';
>> }
>> else {
>> $base_path = '/';
>> }
>> .....
>> So in aiki, perhaps it can be:
>> $config["url"] =
>> 'http' . ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=="on" ?
>> 's' : '') . '://' .
>> $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' .
>> $_SERVER['SERVER_PORT'] : '') .
>> preg_replace("/" . basename($_SERVER['SCRIPT_NAME']) . "$/", "",
>> $_SERVER['SCRIPT_NAME']);
>
> --
> Jakub Jankiewicz
> twitter: @jcubic
> www: http://jcubic.pl
>
> --
> You received this bug notification because you are a member of
> Fabricatorz Developers, which is subscribed to aikiframework 0.9.0.
> https://bugs.launchpad.net/bugs/927527
>
> Title:
> there is not an easy way to change aiki_config options from config.php
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions
>

--
Jon Phillips 王✳爻气 http://fabricatorz.com ✳ skype: kidproto ✳ irc: rejon
+1.415.830.3884 (global) ✳ +86-187-1003-9974 (beijing)

rejon (rejon) wrote :

I just tried this really quickly and it didn't work out with $config["url"] = 'http://somesite/';

I think it needs more investigation, and might need to be paired with changing the upload path and the top folder config options?

rg1024 (rg1024) wrote :

Jon, it is working.

a) Change the file AIKI_ROOT/config.php (not the AIKI_ROOT/configs/config.php)
Put in line 135 (just after, $config=array() ; the line
$config['url']= "http://foo.bar";

b) if problems persists see if in aiki_configs, there is a record with config_name=url
SELECT * FROM `aiki_configs` WHERE config_name='url'.
Delete record.

c) if problems persists, see if you are using the adequate markup in widget [root] or a absolute path

Meantime, i change this bug to incomplete.

Changed in aikiframework:
status: Confirmed → Incomplete

So this just temporarily overrides the setting in the database? How
can we set the setting in the database with some one time code
function in AIKI_ROOT/config.php?

This is great to have so we don't have to jump into the sql dump each
time we move a site!

Jon

On Fri, Feb 10, 2012 at 3:38 AM, rg1024 <email address hidden> wrote:
> Jon,  it is working.
>
> a) Change the file AIKI_ROOT/config.php (not the AIKI_ROOT/configs/config.php)
> Put in line 135 (just after, $config=array() ; the line
> $config['url']= "http://foo.bar";
>
> b) if problems persists see if in aiki_configs, there is a record with config_name=url
> SELECT * FROM `aiki_configs` WHERE config_name='url'.
> Delete record.
>
> c) if problems persists, see if you are using the adequate markup in
> widget [root]  or a absolute path
>
> Meantime, i change this bug to incomplete.
>
>
>
> ** Changed in: aikiframework
>       Status: Confirmed => Incomplete
>
> --
> You received this bug notification because you are a member of
> Fabricatorz Developers, which is subscribed to aikiframework 0.9.0.
> https://bugs.launchpad.net/bugs/927527
>
> Title:
>  there is not an easy way to change aiki_config options from config.php
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions

--
Jon Phillips 王✳爻气 http://fabricatorz.com ✳ skype: kidproto ✳ irc: rejon
+1.415.830.3884 (global) ✳ +86-187-1003-9974 (beijing)

This url should be removed from AIKI I post the code and rg1024 post
fixed version. Url should be pulled in php based on place where
index.php is located.

On Fri, 10 Feb 2012 02:57:37 -0000
rejon <email address hidden> wrote:

> So this just temporarily overrides the setting in the database? How
> can we set the setting in the database with some one time code
> function in AIKI_ROOT/config.php?
>
> This is great to have so we don't have to jump into the sql dump each
> time we move a site!
>
> Jon
>
> On Fri, Feb 10, 2012 at 3:38 AM, rg1024 <email address hidden>
> wrote:
> > Jon,  it is working.
> >
> > a) Change the file AIKI_ROOT/config.php (not the
> > AIKI_ROOT/configs/config.php) Put in line 135 (just after,
> > $config=array() ; the line $config['url']= "http://foo.bar";
> >
> > b) if problems persists see if in aiki_configs, there is a record
> > with config_name=url SELECT * FROM `aiki_configs` WHERE
> > config_name='url'. Delete record.
> >
> > c) if problems persists, see if you are using the adequate markup in
> > widget [root]  or a absolute path
> >
> > Meantime, i change this bug to incomplete.
> >
> >
> >
> > ** Changed in: aikiframework
> >       Status: Confirmed => Incomplete
> >
> > --
> > You received this bug notification because you are a member of
> > Fabricatorz Developers, which is subscribed to aikiframework 0.9.0.
> > https://bugs.launchpad.net/bugs/927527
> >
> > Title:
> >  there is not an easy way to change aiki_config options from
> > config.php
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions
>
>

--
Jakub Jankiewicz
twitter: @jcubic
www: http://jcubic.pl

You want to get into this release? it should get tested well.

On Friday, February 10, 2012, Jakub Jankiewicz wrote:

> This url should be removed from AIKI I post the code and rg1024 post
> fixed version. Url should be pulled in php based on place where
> index.php is located.
>
> On Fri, 10 Feb 2012 02:57:37 -0000
> rejon <<email address hidden> <javascript:;>> wrote:
>
> > So this just temporarily overrides the setting in the database? How
> > can we set the setting in the database with some one time code
> > function in AIKI_ROOT/config.php?
> >
> > This is great to have so we don't have to jump into the sql dump each
> > time we move a site!
> >
> > Jon
> >
> > On Fri, Feb 10, 2012 at 3:38 AM, rg1024 <<email address hidden><javascript:;>
> >
> > wrote:
> > > Jon, it is working.
> > >
> > > a) Change the file AIKI_ROOT/config.php (not the
> > > AIKI_ROOT/configs/config.php) Put in line 135 (just after,
> > > $config=array() ; the line $config['url']= "http://foo.bar";
> > >
> > > b) if problems persists see if in aiki_configs, there is a record
> > > with config_name=url SELECT * FROM `aiki_configs` WHERE
> > > config_name='url'. Delete record.
> > >
> > > c) if problems persists, see if you are using the adequate markup in
> > > widget [root] or a absolute path
> > >
> > > Meantime, i change this bug to incomplete.
> > >
> > >
> > >
> > > ** Changed in: aikiframework
> > > Status: Confirmed => Incomplete
> > >
> > > --
> > > You received this bug notification because you are a member of
> > > Fabricatorz Developers, which is subscribed to aikiframework 0.9.0.
> > > https://bugs.launchpad.net/bugs/927527
> > >
> > > Title:
> > > there is not an easy way to change aiki_config options from
> > > config.php
> > >
> > > To manage notifications about this bug go to:
> > > https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions
> >
> >
>
> --
> Jakub Jankiewicz
> twitter: @jcubic
> www: http://jcubic.pl
>
> _______________________________________________
> Mailing list: https://launchpad.net/~aikiframework-devel
> Post to : <email address hidden> <javascript:;>
> Unsubscribe : https://launchpad.net/~aikiframework-devel
> More help : https://help.launchpad.net/ListHelp
>

--
Jon Phillips 王✳爻气 http://fabricatorz.com ✳ skype: kidproto ✳ irc: rejon
+1.415.830.3884 (global) ✳ +86-187-1003-9974 (beijing)

Jakub Jankiewicz (jcubic) wrote :

I think that it can go to 0.9.0, And testing will be simple simple
point different domain in apache config for you installation and see if
the site is working, launching Admin Panel is a good test.

On Fri, 10 Feb 2012 18:19:08 +0800
Jon Phillips <email address hidden> wrote:

> You want to get into this release? it should get tested well.
>
> On Friday, February 10, 2012, Jakub Jankiewicz wrote:
>
> > This url should be removed from AIKI I post the code and rg1024 post
> > fixed version. Url should be pulled in php based on place where
> > index.php is located.
> >
> > On Fri, 10 Feb 2012 02:57:37 -0000
> > rejon <<email address hidden> <javascript:;>> wrote:
> >
> > > So this just temporarily overrides the setting in the database?
> > > How can we set the setting in the database with some one time code
> > > function in AIKI_ROOT/config.php?
> > >
> > > This is great to have so we don't have to jump into the sql dump
> > > each time we move a site!
> > >
> > > Jon
> > >
> > > On Fri, Feb 10, 2012 at 3:38 AM, rg1024
> > > <<email address hidden><javascript:;>
> > >
> > > wrote:
> > > > Jon, it is working.
> > > >
> > > > a) Change the file AIKI_ROOT/config.php (not the
> > > > AIKI_ROOT/configs/config.php) Put in line 135 (just after,
> > > > $config=array() ; the line $config['url']= "http://foo.bar";
> > > >
> > > > b) if problems persists see if in aiki_configs, there is a
> > > > record with config_name=url SELECT * FROM `aiki_configs` WHERE
> > > > config_name='url'. Delete record.
> > > >
> > > > c) if problems persists, see if you are using the adequate
> > > > markup in widget [root] or a absolute path
> > > >
> > > > Meantime, i change this bug to incomplete.
> > > >
> > > >
> > > >
> > > > ** Changed in: aikiframework
> > > > Status: Confirmed => Incomplete
> > > >
> > > > --
> > > > You received this bug notification because you are a member of
> > > > Fabricatorz Developers, which is subscribed to aikiframework
> > > > 0.9.0. https://bugs.launchpad.net/bugs/927527
> > > >
> > > > Title:
> > > > there is not an easy way to change aiki_config options from
> > > > config.php
> > > >
> > > > To manage notifications about this bug go to:
> > > > https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions
> > >
> > >
> >
> > --
> > Jakub Jankiewicz
> > twitter: @jcubic
> > www: http://jcubic.pl
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~aikiframework-devel
> > Post to : <email address hidden> <javascript:;>
> > Unsubscribe : https://launchpad.net/~aikiframework-devel
> > More help : https://help.launchpad.net/ListHelp
> >
>
>

--
Jakub Jankiewicz
twitter: @jcubic
www: http://jcubic.pl

rejon (rejon) wrote :
Download full text (3.2 KiB)

I think there is also the issue of the upload path and top folder.

Ok, want to get this ocal 3.1 and aiki 0.9.0 out so bad, we need some cheer!

Jon

On Friday, February 10, 2012, Jakub Jankiewicz wrote:

> I think that it can go to 0.9.0, And testing will be simple simple
> point different domain in apache config for you installation and see if
> the site is working, launching Admin Panel is a good test.
>
> On Fri, 10 Feb 2012 18:19:08 +0800
> Jon Phillips <<email address hidden> <javascript:;>> wrote:
>
> > You want to get into this release? it should get tested well.
> >
> > On Friday, February 10, 2012, Jakub Jankiewicz wrote:
> >
> > > This url should be removed from AIKI I post the code and rg1024 post
> > > fixed version. Url should be pulled in php based on place where
> > > index.php is located.
> > >
> > > On Fri, 10 Feb 2012 02:57:37 -0000
> > > rejon <<email address hidden> <javascript:;> <javascript:;>> wrote:
> > >
> > > > So this just temporarily overrides the setting in the database?
> > > > How can we set the setting in the database with some one time code
> > > > function in AIKI_ROOT/config.php?
> > > >
> > > > This is great to have so we don't have to jump into the sql dump
> > > > each time we move a site!
> > > >
> > > > Jon
> > > >
> > > > On Fri, Feb 10, 2012 at 3:38 AM, rg1024
> > > > <<email address hidden> <javascript:;><javascript:;>
> > > >
> > > > wrote:
> > > > > Jon, it is working.
> > > > >
> > > > > a) Change the file AIKI_ROOT/config.php (not the
> > > > > AIKI_ROOT/configs/config.php) Put in line 135 (just after,
> > > > > $config=array() ; the line $config['url']= "http://foo.bar";
> > > > >
> > > > > b) if problems persists see if in aiki_configs, there is a
> > > > > record with config_name=url SELECT * FROM `aiki_configs` WHERE
> > > > > config_name='url'. Delete record.
> > > > >
> > > > > c) if problems persists, see if you are using the adequate
> > > > > markup in widget [root] or a absolute path
> > > > >
> > > > > Meantime, i change this bug to incomplete.
> > > > >
> > > > >
> > > > >
> > > > > ** Changed in: aikiframework
> > > > > Status: Confirmed => Incomplete
> > > > >
> > > > > --
> > > > > You received this bug notification because you are a member of
> > > > > Fabricatorz Developers, which is subscribed to aikiframework
> > > > > 0.9.0. https://bugs.launchpad.net/bugs/927527
> > > > >
> > > > > Title:
> > > > > there is not an easy way to change aiki_config options from
> > > > > config.php
> > > > >
> > > > > To manage notifications about this bug go to:
> > > > >
> https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions
> > > >
> > > >
> > >
> > > --
> > > Jakub Jankiewicz
> > > twitter: @jcubic
> > > www: http://jcubic.pl
> > >
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~aikiframework-devel
> > > Post to : <email address hidden> <javascript:;><javascript:;>
> > > Unsubscribe : https://launchpad.net/~aikiframework-devel
> > > More help : https://help.launchpad.net/ListHelp
> > >
> >
> >
>
> --
> Jakub Jankiewicz
> twitter: @jcubic
> www: http://jcubic.pl
>

--
Jon Phillips 王✳爻气 http://fabricatorz...

Read more...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers