Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-30 Thread Antoine Musso
Le 22/05/13 21:36, Daniel Friesen a écrit :
 What's your problem with WebRequest anyways?

My only problem is that it is MediaWiki specific. I am still hoping we
will slowly move to reuse third party components which will make it
easier for experienced developers to join us without having to learn our
framework. :-d

-- 
Antoine hashar Musso


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Jeroen De Dauw
Hey,

I'd like to load MediaWiki from some PHP script and have not been able to
find a way to do this so far.

After someone suggested trying to do this as a maintenance script, I tried
http://pastebin.com/scKFxF2J

That however does not work as there is a check in doMaintenance.php
(shouldExecute) that makes sure initialization is only done when no
function calls are present in the call stack. My script is getting called
by some other library and thus there will clearly be function calls in the
call stack when doMaintenance.php is included. Is it even possible to load
MediaWiki in such a case? And what is this restriction in shouldExecute
good for?

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Tyler Romeo
What exactly do you mean by load MediaWiki? What's the use case? Maybe
try making your own entry point?

*-- *
*Tyler Romeo*
Stevens Institute of Technology, Class of 2015
Major in Computer Science
www.whizkidztech.com | tylerro...@gmail.com


On Wed, May 22, 2013 at 11:16 AM, Jeroen De Dauw jeroended...@gmail.comwrote:

 Hey,

 I'd like to load MediaWiki from some PHP script and have not been able to
 find a way to do this so far.

 After someone suggested trying to do this as a maintenance script, I tried
 http://pastebin.com/scKFxF2J

 That however does not work as there is a check in doMaintenance.php
 (shouldExecute) that makes sure initialization is only done when no
 function calls are present in the call stack. My script is getting called
 by some other library and thus there will clearly be function calls in the
 call stack when doMaintenance.php is included. Is it even possible to load
 MediaWiki in such a case? And what is this restriction in shouldExecute
 good for?

 Cheers

 --
 Jeroen De Dauw
 http://www.bn2vs.com
 Don't panic. Don't be evil.
 --
 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Chad
Making entry points isn't straightforward (which is why I suggested
maintenance), but it can be done.

We really need to cleanup the bootstrap process.

-Chad
On May 22, 2013 8:48 AM, Tyler Romeo tylerro...@gmail.com wrote:

 What exactly do you mean by load MediaWiki? What's the use case? Maybe
 try making your own entry point?

 *-- *
 *Tyler Romeo*
 Stevens Institute of Technology, Class of 2015
 Major in Computer Science
 www.whizkidztech.com | tylerro...@gmail.com


 On Wed, May 22, 2013 at 11:16 AM, Jeroen De Dauw jeroended...@gmail.com
 wrote:

  Hey,
 
  I'd like to load MediaWiki from some PHP script and have not been able to
  find a way to do this so far.
 
  After someone suggested trying to do this as a maintenance script, I
 tried
  http://pastebin.com/scKFxF2J
 
  That however does not work as there is a check in doMaintenance.php
  (shouldExecute) that makes sure initialization is only done when no
  function calls are present in the call stack. My script is getting called
  by some other library and thus there will clearly be function calls in
 the
  call stack when doMaintenance.php is included. Is it even possible to
 load
  MediaWiki in such a case? And what is this restriction in shouldExecute
  good for?
 
  Cheers
 
  --
  Jeroen De Dauw
  http://www.bn2vs.com
  Don't panic. Don't be evil.
  --
  ___
  Wikitech-l mailing list
  Wikitech-l@lists.wikimedia.org
  https://lists.wikimedia.org/mailman/listinfo/wikitech-l
 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Daniel Friesen

On Wed, 22 May 2013 08:50:51 -0700, Chad innocentkil...@gmail.com wrote:


Making entry points isn't straightforward (which is why I suggested
maintenance), but it can be done.

We really need to cleanup the bootstrap process.


https://www.mediawiki.org/wiki/Requests_for_comment/Entrypoint_Routing_and_404_handling


-Chad


--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Jeroen De Dauw
Hey,

Making entry points isn't straightforward (which is why I suggested
 maintenance), but it can be done.

 We really need to cleanup the bootstrap process.


So you are saying it currently is not possible and that a new entry point
needs to be created?

If so, is there any way to get such a thing done in a short period of time?
I can throw an hour at it or so, but not more.

What exactly do you mean by load MediaWiki?


Making it so that I can run code that uses some MediaWiki classes.

What's the use case?


Testing of code that depends on MediaWiki.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Chad
On Wed, May 22, 2013 at 9:05 AM, Jeroen De Dauw jeroended...@gmail.com wrote:
 Hey,

 Making entry points isn't straightforward (which is why I suggested
 maintenance), but it can be done.

 We really need to cleanup the bootstrap process.


 So you are saying it currently is not possible and that a new entry point
 needs to be created?

 If so, is there any way to get such a thing done in a short period of time?
 I can throw an hour at it or so, but not more.


It seems like it...I'm sorry if I mislead you the other day in trying
to use maintenance, I suppose I just misunderstood your needs.

The pattern in WebStart or Maintenance should give you enough
to go on. I can't promise it's a 1 hour or less task, but it shouldn't
take you too long.

Yeah it sucks, but that just reinforces my point about us needing
to fix this.

FWIW, the request routing stuff is neat, but it's probably overkill
for what we're needing here. Incremental improvements can be
made to the bootstraping if anyone is brave enough to play with
Setup.php ;-)

-Chad

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Jeroen De Dauw
Hey,

I hacked up something extremely evil which is now working for my usecase:
http://pastebin.com/WcT1MPNv

Clearly this is far from ideal since my code should not know about MW
internal at all, it should just include some entry point file.

One fun thing I had to do was stuff all local variables in the global
vraibles list, since some setup files are assuming they are run in global
scope, and some are assuming they are in the same scope as the other files.
Since my script is not getting executed in global scope, it is sort of hard
to load these files in global scope :)

So if someone could create a working solution that has an evilness level of
less then 9000, I'd be very happy.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Nischay Nahata
http://www.mediawiki.org/wiki/File:Mediawiki-vagrant-screenshot.png

Does this help?


On Wed, May 22, 2013 at 10:17 PM, Jeroen De Dauw jeroended...@gmail.comwrote:

 Hey,

 I hacked up something extremely evil which is now working for my usecase:
 http://pastebin.com/WcT1MPNv

 Clearly this is far from ideal since my code should not know about MW
 internal at all, it should just include some entry point file.

 One fun thing I had to do was stuff all local variables in the global
 vraibles list, since some setup files are assuming they are run in global
 scope, and some are assuming they are in the same scope as the other files.
 Since my script is not getting executed in global scope, it is sort of hard
 to load these files in global scope :)

 So if someone could create a working solution that has an evilness level of
 less then 9000, I'd be very happy.

 Cheers

 --
 Jeroen De Dauw
 http://www.bn2vs.com
 Don't panic. Don't be evil.
 --
 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l




-- 
Cheers,

Nischay Nahata
nischayn22.in
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Jeroen De Dauw
Hey,

Another problem with this current approach is that it will cause extensions
to be loaded, which I have no use for. This however seems hard to get
around due to LocalSettings both defining needed config and including the
extensions.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Daniel Friesen
On Wed, 22 May 2013 09:47:14 -0700, Jeroen De Dauw  
jeroended...@gmail.com wrote:



Hey,

I hacked up something extremely evil which is now working for my usecase:
http://pastebin.com/WcT1MPNv


Looks like we just need to abstract most of WebStart.php and part of  
doMaintenance into something like includes/Start.php to support things  
that are neither web nor maintenance.


--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Antoine Musso
Le 22/05/13 17:57, Daniel Friesen a écrit :
 On Wed, 22 May 2013 08:50:51 -0700, Chad innocentkil...@gmail.com wrote:
 
 Making entry points isn't straightforward (which is why I suggested
 maintenance), but it can be done.

 We really need to cleanup the bootstrap process.
 
 https://www.mediawiki.org/wiki/Requests_for_comment/Entrypoint_Routing_and_404_handling

Ok I am hijacking the thread.

http://symfony.com/doc/current/components/routing/introduction.html

:-)

That is a robust standalone lib that would give us proper routing and
let us dish out WebRequest.  You can even define the routes in a YAML
file yu.


-- 
Antoine hashar Musso


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Tyler Romeo
On Wed, May 22, 2013 at 1:12 PM, Daniel Friesen
dan...@nadir-seen-fire.comwrote:

 Looks like we just need to abstract most of WebStart.php and part of
 doMaintenance into something like includes/Start.php to support things that
 are neither web nor maintenance.


Honestly, why don't we just move that stuff into Setup.php. I mean, pretty
much every entry point script includes Setup.php anyway. The only things
that should be done in entry points is stuff that's specific to that entry
point.

*-- *
*Tyler Romeo*
Stevens Institute of Technology, Class of 2015
Major in Computer Science
www.whizkidztech.com | tylerro...@gmail.com
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Daniel Friesen
On Wed, 22 May 2013 11:18:29 -0700, Tyler Romeo tylerro...@gmail.com  
wrote:



On Wed, May 22, 2013 at 1:12 PM, Daniel Friesen
dan...@nadir-seen-fire.comwrote:


Looks like we just need to abstract most of WebStart.php and part of
doMaintenance into something like includes/Start.php to support things  
that

are neither web nor maintenance.



Honestly, why don't we just move that stuff into Setup.php. I mean,  
pretty

much every entry point script includes Setup.php anyway. The only things
that should be done in entry points is stuff that's specific to that  
entry

point.


There are entrypoint specific things that have to be done before Setup.php  
but after other common stuff you'd think of putting inside Setup.php.


Settings can be entrypoint specific. Web start needs to do things like  
setup output buffering before including Setup. etc...


--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Daniel Friesen
On Wed, 22 May 2013 11:17:13 -0700, Antoine Musso hashar+...@free.fr  
wrote:



Le 22/05/13 17:57, Daniel Friesen a écrit :
On Wed, 22 May 2013 08:50:51 -0700, Chad innocentkil...@gmail.com  
wrote:



Making entry points isn't straightforward (which is why I suggested
maintenance), but it can be done.

We really need to cleanup the bootstrap process.


https://www.mediawiki.org/wiki/Requests_for_comment/Entrypoint_Routing_and_404_handling


Ok I am hijacking the thread.

http://symfony.com/doc/current/components/routing/introduction.html

:-)

That is a robust standalone lib that would give us proper routing and
let us dish out WebRequest.  You can even define the routes in a YAML
file yu.


* The router does not handle non-routed stuff. So it can't properly handle  
support for both routed paths and routing queries to various entrypoints.

* WebRequest does much more than routing so it's not going to disappear.

I've also been contemplating reverse routing. Defining the rules we  
generate many urls with. Trying to define most of that info inside the  
same place we route paths. To make defining new things like routing for  
the ShortUrl extension, etc... or things like the NamespacePaths extension  
simpler.


Besides making custom path patterns simpler that plan was also to tackle  
our issue with things like non-indexed paths vs. indexed ones.
Right now we blindly send all non-query paths to an indexed path (the  
short url) and all queried paths to non-indexed ones.
While we have some non-query URIs that would be best always non-indexed  
(like Search) and some query URIs that actually should be indexed (like  
query pages beyond the first page; after we add rel=next/prev to the  
category page).
Additionally it would be ideal for our non-indexed path to be a pretty url  
too. There is no reason that our non-indexed urls have to be index.php.


--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Jeroen De Dauw
Hey,

 * WebRequest does much more than routing

:(

 so it's not going to disappear.

:((

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Daniel Friesen
On Wed, 22 May 2013 12:31:50 -0700, Jeroen De Dauw  
jeroended...@gmail.com wrote:



Hey,


* WebRequest does much more than routing


:(


so it's not going to disappear.


:((

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--


What's your problem with WebRequest anyways?

--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Loading MediaWiki from some script

2013-05-22 Thread Tyler Romeo
On May 22, 2013 3:36 PM, Daniel Friesen dan...@nadir-seen-fire.com
wrote:

 On Wed, 22 May 2013 12:31:50 -0700, Jeroen De Dauw jeroended...@gmail.com
wrote:

 Hey,

 * WebRequest does much more than routing


 :(

 so it's not going to disappear.


 :((

 Cheers

 --
 Jeroen De Dauw
 http://www.bn2vs.com
 Don't panic. Don't be evil.
 --


 What's your problem with WebRequest anyways?


 --
 ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]




Agreed. WebRequest isn't that bad. It could use some cleanup, but overall
I've found it pretty useful.

Also, I didn't realize WebRequest had anything to do with routing at all.
It was my understanding that it is more just an object oriented interface
to $_GET and whatnot.
___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l