chrizz
Members-
Posts
126 -
Joined
-
Last visited
Everything posted by chrizz
-
Is there an easy way to enable/disable Tracy debugger via API? As I am still on my way to create test with PHPUnit it would be awesome if there's an easy way (ideally via config.php) to disable tracy if it's called from the phpunit testing scripts.
-
Just as a heads up if someone needs database testing: I am trying a different approach at the moment: I simply added a database configuration to the config.php which is used if PW is called from PHPUnit. in config.php if(isset($_ENV['UNITTEST']) && $_ENV['UNITTEST'] == true) { $config->dbHost = 'localhost'; $config->dbName = 'db-test'; $config->dbUser = '...'; $config->dbPass = '...'; $config->dbPort = '3306'; $config->httpHosts = array('localhost'); } and my PHPUnit configuration.xml looks like this <phpunit ... some settings here ... > <php> <env name="UNITTEST" value="true" /> </php> </phpunit> maybe this will save someone a headache in the future
-
Generation of hreflang links for search engines as a module?
chrizz replied to chrizz's topic in Module/Plugin Development
I think these two lines would be fine. I guess you don't have the need for an additional module but maybe someone else will join the discussion with a different approach/opinion on that?- 6 replies
-
- multilanguage
- seo
-
(and 1 more)
Tagged with:
-
Generation of hreflang links for search engines as a module?
chrizz replied to chrizz's topic in Module/Plugin Development
Ah ok. I was afraid that I missed something But anyways: same does the module during the installation process: It adds language and country code fields to each language template. Regarding x-default, I'd recommend this for reading: https://www.rebelytics.com/multiple-hreflang-tags-one-url/- 6 replies
-
- 1
-
-
- multilanguage
- seo
-
(and 1 more)
Tagged with:
-
Generation of hreflang links for search engines as a module?
chrizz replied to chrizz's topic in Module/Plugin Development
@Sergio yeah, it's not that complicated - therefore I asked how you handle this before submitting a module Regarding your snippet: imho "x-default" is missing here. If you don't want you site to be listed in other languages/regions as defined than your snippets works fine but as soon as you have a default language for the world's audience this won't work. May I ask where this comes from? $language->lang_code; Maybe I have some weird old setup but this variable is empty- 6 replies
-
- multilanguage
- seo
-
(and 1 more)
Tagged with:
-
hey there I guess a lot of you have already heard of the hreflang attribute which tells search engines which URL they should list on their result pages. For some of my projects I build this manually but now I am wondering if there's need to add this as a module to PW modules directory. How do you deal with the hreflang thingy? Would you you be happy if you can use a module for this or do you have concerns that using a module maybe does not cover your current use cases? Cheers, Chris
- 6 replies
-
- multilanguage
- seo
-
(and 1 more)
Tagged with:
-
I think this heavily depends on the use cases and the size of the project (e.g. amount of data, people involved). I am currently working on a project where I started to do everything from scratch, but then moved to PW because it saves a lot of time regarding standard functionality (e.g. permissions, login, caching, security in general). I have also worked for several companies building Saas platforms - for these kind of uses cases PW would be not the best choice. The use cases here were much to special, need a lot of DB tweaking, rely on different DB types (e.g. Elastic Search, Postgres, Lucene) and so on. If you want to save time by having standard functionality out of the box: I'd use PW. If you have enough capacity to build this on your own because you expect that you scale that fast that PW is simply the "wrong" framework: I'd think of a pure framework. But as said: It's easy to export data from PW, so this might be a third option: start with PW, scale fast, move to something else
-
thanks for your feedback. I added the link in the post above. Don't know what went wrong during the submission process... maybe just a newbie error Thanks @adrianfor fixing it!
-
Usually I write modules just for me and my projects because they are more or less individual. Mail Debugger is the first module which might be interested for someone else as well. https://modules.processwire.com/modules/mail-debugger/ Basically it covers two use cases: 1) Log outgoing emails 2) In debug mode mails are send to a specified email address instead of the original recipient(s) I checked the compatibility for PW 3+ because unfortunately I don't have any other version for testing currently. Feel free to drop me a comment if the module works also for older PW versions.
-
yeah, that might be a approach I can test. Since I use a very comfortable way of modifying the date/time by freezing it at some point this could definitively work. Thanks for the idea of using a multi-instance
-
I am currently developing a little application which is supposed to run on a raspberry. I decided to take advantage of PW's capabilities to deal with data not only in the sense of a common website but more as an application. I wrote a lot of modules for this and I wrote tests for some of the methods (using PHPUnit). This works fine so far for methods which are independent from database (e.g. calculating an upcoming date/time by a given schedule). Now I am thinking of extending this by writing tests also for methods which rely on data from the database (e.g. it need to be checked if something exists on that given date/time). This information is currently stored as page in PW. One of my thoughts: create necessary pages in PW for running the test and delete them afterwards. But somehow this just feels wrong. Any kind of input how you would tackle this would be great! Thanks a lot!
-
hehe... fair enough to check for a closing tag Next time I'll promise I'll use correct markup which would have solved the problem right away. Thanks for your support
-
@horst it doesn't have any tags (except the tags I am adding to the message manually). I tried a downgrade to 0.2.3 => no success - same problems I just installed version 0.2.5 => still no tags but the signature is there... this is what the mail content looks like (headers are removed) --3e089748ac63f63eedf33dc907a71870 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable hallo -- PLAIN blablabla --3e089748ac63f63eedf33dc907a71870 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <strong>hallo</strong> HTML <br><br><strong>blablabla</strong> --3e089748ac63f63eedf33dc907a71870-- so it seems as if my problem has been solved - but it's still somehow weird that there are not tags... If you want me to share more details and/or sources please let me know. Would be glad if I can help you Thanks for providing this module & the support!
-
@hellomoto I couldn't reproduce this. Which version of WireMailSmtp you're using? I am on the same PW version but I am currently struggeling with the HTML signature. Using this code, triplechecked that at HTML signature is stored in the WireMailSmtp settings, but - and thats the fun fact - it does not work within a HTML mail - but the signature is added to the plaintext. $mail = wireMail(); $mail->from($email, $name); $mail->to("me@me.com", "Me"); $mail->subject('new message - '.$config->httpHost); //$mail->addSignature(true); ==> has no effect either since I chose "send signature with _every_ message" in the module settings $mail->bodyHTML($message); $mail->send(); Has this happened to anyone before? And if so: how did you solve this?
-
i was referring to your post here: https://stackoverflow.com/questions/34225720/keep-getting-you-cannot-serialize-or-unserialize-pdo-instances-in-phpunit-usin namespace Test; include_once(__DIR__."/../../../../index.php"); //Bootstrap to Processwire CMS class ImageTest extends \PHPUnit_Framework_TestCase { /** * @backupGlobals disabled * @backupStaticAttributes disabled * @runTestsInSeparateProcesses * @runInSeparateProcess * @preserveGlobalState disabled */ protected function setUp() { //$this->testpages = wire(pages)->find("template=fingergames|template=songs|template=poems"); } [...] } And no, I am not using PHPStorm but Netbeans. Finally I managed it use PHPUnit with PW modules. In the end it was a combination of a config XML backupGlobals="false" backupStaticAttributes="false" bootstrapping the PW index.php and include a setUp method within the test class with the correct namespaces Example (maybe someone needs something like this) <?php use PHPUnit\Framework\TestCase; class testMe extends TestCase { protected function setUp() { global $wire; $this->wire = $wire; } public function test_getNextRuntimeFromCycle() { $res = $this->wire->modules->get("testMe")->myMethodWorks(); $this->assertEquals(true, $res); } }
-
quite an old thread, but I started to test some basic functionality and I can't get this to work... I don't use selenium but only PHPUnit to test some functions within modules. But whatever I try it fails. Basically I can decide whether I want to see this message: PDOException: You cannot serialize or unserialize PDO instances or - if I follow these rules https://blogs.kent.ac.uk/webdev/2011/07/14/phpunit-and-unserialized-pdo-instances/ - ERROR: application encountered an error and can not continue. Error was logged. Anyone who struggled with this as well? And - more important - any suggestions or solutions? big thanks! btw @FrancisChung: based on the stackoverflow post I think you just pasted the annotations at the wrong place. It must be outside the class {}
-
Warning about Server Locale after update from 3.0.52 > 3.0.53 - Help!
chrizz replied to EyeDentify's topic in General Support
I'd add it to the config just because to me a locale is like a config value. init.php might be a little late because auto load modules are already initialized https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/- 40 replies
-
- 3
-
-
- serverlocale
- 3.0.52
-
(and 1 more)
Tagged with:
-
Does the XML feed contain *all* data always? I had to deal with a slightly different issue (include a facebook news stream with search, pagination etc), and I decided to create real PW pages from all feed items. This gave me the flexibility to use the build-in functions without building an extensive Facebook API connector. How much items do you have to handle? Happy guess: you can create a WireArray (https://processwire.com/api/arrays/) from the feed data which contains already some build-in methods (unfortuantely not the pagination thingy)
-
max file size validation for file/image fields
chrizz replied to chrizz's topic in Wishlist & Roadmap
I quickly wanted to follow up this issue. I am not sure if edition a post including a mention triggers a notification -
@adrian thanks a lot for sharing this and for pointing me in the right direction! To clear the original values you can just pass "null" to the "to" method: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireMail.php#L152 Same works for cc & bcc, but to be honest, I only tested this in combination with WireMailSmtp. It might look different without WireMailSmtp (e.g. no cc/bcc) The whole hook function looks like this and it works as expected. $this->addHookBefore('WireMailSmtp::send', null, function($event) { if(!$this->config->debug) { // when not in debug mode do nothing return; } $mail = &$event->object; // store orgiginal recpients $recipients = array( 'to' => $mail->to, 'toName' => $mail->toName, 'cc' => $mail->cc, 'ccName' => $mail->ccName, 'bcc' => $mail->bcc, ); // reset all original recipients $mail->to(null); $mail->cc(null); $mail->bcc(null); // add debug recepient $mail->to = 'Dropbox <dropbox@my-domain.com>'; // create debug information for mailbody $debug_body = '### DEBUG INFO ###<br />'; $debug_body .= 'TO: '.implode($recipients['to'], ', ').'<br />'; $debug_body .= 'CC: '.implode($recipients['cc'], ', ').'<br />'; $debug_body .= 'BCC: '.implode($recipients['bcc'], ', ').'<br />'; $debug_body .= '### / DEBUG INFO ###<br /><br />'; // replace original mailbody $new_mailbody = str_replace('<body>', '<body>'.$debug_body, $mail->bodyHTML); $mail->bodyHTML($new_mailbody); return; });
-
@adrian although tracy seems to be really oversized for this use case but it is quite interesting and it works thanks for the tip!
-
I was wondering if it'll be possible to hook the ___send method to manipulate the recipient(s) and body of the mail. I was able to hook the method basically but I couldn't manage to manipulate the original data :/ Thanks in advance for any hints use case for this: In debug mode (e.g. local or on staging) all mails should be send to a dedicated dropbox instead of the original recipient. This information should be added to the mail body instead. Original e-mail - send to xy@domain.com Hello XY, thanks for your email. [...] Manipulated e-mail - send to dropbox@developer.net # Debug Info # Original recipient: xy@domain.com Hello XY, thanks for your email. [...]
-
max file size validation for file/image fields
chrizz replied to chrizz's topic in Wishlist & Roadmap
here they are. Didn't find any relevant meta data in the image itself. It's imho only about the quality of the jpeg (97 vs. 50). The first one hits the memory limit, the second one didn't. @horst edited examples.zip -
max file size validation for file/image fields
chrizz replied to chrizz's topic in Wishlist & Roadmap
well... in theory... ^^ I just tested it: jpeg 3888 x 2592 original file size: 5,1 MB ==> hits the PHP limit same image after saving it again with only 50% quality jpeg 3888 x 2592 new file size: 0,8 MB ==> does not hit the PHP limit, scaling works as expected I expected these results because reducing the quality does not reduce the actual size of the image but the number of information (e.g. in the first example every pixel has it's own color definition while in the second example color information is combined e.g. 4 pixels contain the same color ==> file size is reduced) but maybe @horst is deep into the theory and might be able to explain how it really works -
max file size validation for file/image fields
chrizz replied to chrizz's topic in Wishlist & Roadmap
@LostKobrakai thanks for having a look! But to make sure (and avoid extra work) I was not talking about chunked uploads but only about a file size limit for a single file. Uploading a 5MB file (4000x4000px) works fine on the shared webspace but when the ImageResizer enters the game the PHP memory limit is hit when it's trying to resize the image to 1000x1000px To avoid this we need to optimize the file size before uploading it to PW. Having a 2MB 4000x4000px image works fine when it is resized. In my imagination the file/image field get a new option: max file size. The validation (simple JS check if the file selected for uploading is larger than the limit) happens on client side with the FileReader