[3.1][3.2][3.3][RC] Twig Converter

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
hubaishan
Translator
Posts: 155
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by hubaishan »

Why twig?!
What can twig do, phpBB template can't?
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [3.1][3.2][RC] Twig Converter

Post by david63 »

hubaishan wrote: Wed Nov 08, 2017 2:14 pm Why twig?!
What can twig do, phpBB template can't?
Basically so that the phpBB team do not have to maintain the templating framework and can concentrate on working on the core.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [3.1][3.2][RC] Twig Converter

Post by RMcGirr83 »

hubaishan wrote: Wed Nov 08, 2017 2:14 pm Why twig?!
What can twig do, phpBB template can't?
Have a read as to why.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi »

MarkDHamill wrote: Fri Dec 15, 2017 12:47 pm The messenger class uses template tags that go in the /language/en/email folder, so extensions that do emailing like mine must create them in our extensions. In 3.0 it was not as sophisticated as the full templating system. You could not use loops, for example. Perhaps this is no longer the case.

It wasn't a big deal to convert my language files so I did it manually, but you might want to add it to the files to convert.
The latest commit on master adds this feature. Could you test it when you have a moment?
User avatar
Stoker 4.0
Registered User
Posts: 1487
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Stoker 4.0 »

Version 1.2.0 trying to convert prosilver and get this error.

Code: Select all

Fatal error: Uncaught Error: Class 'ZipArchive' not found in /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php:276 Stack trace: #0 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php(240): kasimi\twigconverter\controller\main->make_zip('./../store/', 'prosilver_twig_...', Array) #1 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php(120): kasimi\twigconverter\controller\main->run('prosilver', Array) #2 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/acp/main_module.php(28): kasimi\twigconverter\controller\main->convert('./../adm/index....') #3 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/includes/functions_module.php(676): kasimi\twigconverter\acp\main_module->main('\\kasimi\\twigcon...', 'convert') #4 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/adm/index.php(82): p_master->load_active() #5 {main} thrown in /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php on line 276
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi »

Your PHP installation is missing the ZIP extension: https://stackoverflow.com/questions/387 ... t-found-in
User avatar
Stoker 4.0
Registered User
Posts: 1487
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Stoker 4.0 »

kasimi wrote: Sat Jan 20, 2018 3:57 pm Your PHP installation is missing the ZIP extension: https://stackoverflow.com/questions/387 ... t-found-in
Thanks, found it and installed it. Now it works ;)
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi »

I added an ext.php that checks for this: https://github.com/kasimi/phpbb-ext-twi ... 79d338fd10
User avatar
Stoker 4.0
Registered User
Posts: 1487
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Stoker 4.0 »

Dont know if anybody else can use this guide to install zip in ubuntu. Worked for me and its simple:
https://www.digitalocean.com/community/ ... -in-ubuntu
nou nou
Registered User
Posts: 503
Joined: Sat Oct 29, 2016 8:08 pm

Re: [3.1][3.2][RC] Twig Converter

Post by nou nou »

Just tested this on my test board - it works beautifully! :)

By converting the theme, I have shaved 0.1s and 1 request off my index page alone - that will start to count when talking lots of users...

Now, I also have 2 metric tons of extensions installed on that board so I'm going to ask the lazy person question - how hard would it be to do a "convert all" option in the extension that just takes your board and converts every extension and style it can find. Then all that needs to be done is upload the whole thing to the board and done, everything is converted to twig yay! :)

Of course, if something tiny should go wrong it may be a little harder to troubleshoot, but since the extension uses phpBB core to convert anyway, I think chances of that happening are low...?
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [3.1][3.2][RC] Twig Converter

Post by david63 »

nou nou wrote: Tue Feb 20, 2018 3:52 am Of course, if something tiny should go wrong it may be a little harder to troubleshoot, but since the extension uses phpBB core to convert anyway, I think chances of that happening are low...?
Unless there is something in an extension that does not convert then you may not know which extension is causing the problem - also I am not sure what happens if an extension is already in Twig when you try to convert.

My advice would be convert them one by one and test after each one.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
nou nou
Registered User
Posts: 503
Joined: Sat Oct 29, 2016 8:08 pm

Re: [3.1][3.2][RC] Twig Converter

Post by nou nou »

I understand the risks very well. It's easy enough to restore what I've converted, and for that matter to upload a partial conversion.

I would still love it if there were an option to convert all at the same time, since there is no advantage to doing all the conversions themselves one by one.
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi »

david63 wrote: Tue Feb 20, 2018 7:36 am also I am not sure what happens if an extension is already in Twig when you try to convert
In this case all files in the zip file are identical to the existing ones.

I don't think this feature needs to be added to the extension but this is how you can do it:
  • Find these lines: https://github.com/kasimi/phpbb-ext-twi ... #L114-L121
  • Replace them with these:

    Code: Select all

    $this->run('all', call_user_func_array('array_merge', array_merge(
    	array_map([$this, 'get_extension_template_files'], $available_extensions),
    	array_map([$this, 'get_style_template_files'], $available_styles)
    )));
  • Convert any extension or style. It will convert all extensions and styles.
User avatar
</Solidjeuh>
Registered User
Posts: 1788
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by </Solidjeuh> »

Just an idea, would it be possible to add an option to convert ALL extensions & styles with just one click?
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi »

Please read one post above yours.

This extension is meant to be used by extension developers for an easier transition to Twig. There really is no point in converting all template files of all your styles and extensions if your goal is improving performance because template files are cached. The time you spent reading this post is greater than the CPU time you will ever save by converting all template files.
Post Reply

Return to “Extensions in Development”