Jump to content

Can

Members
  • Posts

    350
  • Joined

  • Last visited

Everything posted by Can

  1. Let's jump right into Stack Overflows new Documentations http://stackoverflow.com/documentation/processwire/commit to spread ProcessWire
  2. Can

    Deployer recipe

    Interesting thanks for sharing! Even shorter And now I get the use of setting shared dirs/files haha So if not in the repo and not shared, how else? Uploading with each deploy? So you're using deployer, too? Update: Have to investigate this further as it's not working for me for now. After trying this out the staging page is unreachable telling me there is no config/installation file..
  3. What about something like this if users should be logged in on all domains http://stackoverflow.com/a/19546680/3484824 or http://subinsb.com/set-same-cookie-on-different-domains ? Never tried it out myself, just stumbled upon this..
  4. Just posted mine in the forums https://processwire.com/talk/topic/13825-deployer-recipe/
  5. Can

    Deployer recipe

    Thanks to a new "community" member I just started using git and deployer for my main project happygaia.com it's soo nice and clean and million times faster to publish a new feature, fix or whatever..I'm still in development or more bug fixing phase so I haven't actually deployed to live stage yet but local to staging works like a breeze so far I already separated processwire deploy logic from project stuff to start a dedicated processwire recipe which looks like this so far <?php /** * Deployer ProcessWire Recipe * Version 0.0.1 */ require_once __DIR__ . '/common.php'; // ProcessWire shared dirs set('shared_dirs', ['site/assets']); // ProcessWire shared files set('shared_files', ['site/config.php']); /** * Symlinking assets and config.php from Deployers shared folder * * @note You have to put those files manually into shared folder before first deploy * To run this task automatically, please add below line to your deploy.php file * <code>after('deploy:symlink', 'processwire:symlink');</code> */ task('processwire:symlink', function() { run("ln -s {{deploy_path}}/shared/assets {{release_path}}/site/assets"); run("ln -s {{deploy_path}}/shared/config.php {{release_path}}/site/config.php"); })->desc('symlinking assets and config.php from shared folder'); /** * Main task */ task('deploy', [ 'deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:symlink', 'cleanup' ])->desc('Deploy your project'); after('deploy', 'success'); As you might note the processwire:symlink task won't run automatically, you either call it manually or like mentioned in the phpdoc you hook into the deploy task and put it e.g. after deploy:symlink Reason for processwire:symlink is that at least happygaias assets folder is quite huge and it's not part of my git repo so it's not being deployed each time instead it gets automatically symlinked from deployers shared folder Side note: Images (for now) only being updated from live page so no need to upload in deployment process.. Nearly forgot to mention that it's not only about assets folder but site/config.php, too. So config.php is not part of my git repo so I place it in deployers shared folder once and it get's symlinked (like with assets) The plan right now is to "just" keep databse of live site intact (more or less) after I switch live to new version it'll update because of new pw version and module versions of course and I have to tweak some minor changes, manually e.g. exporting/importing templates but that's fine for now I might look into AutoExportTemplatesAndFields module soon as it sounds really nice I still have to figure some deployer things out, but as mentioned it seems to work fine for now Okido that's all for now, questions, comments, feedback everything is welcome and appreciated Uh it would be nice to get more ideas and testing whatever for the recipe so I could post it to the deployer repo soon ;-)
  6. Uh now I understand the question..development mode is just disabling minification and caching..maybe file "seperation" could be included as separate option, I for myself like files being concatenated while uncompressed for development..and if I really don't now which file a line belongs to I just Sublime search in all files and done.. ;-)
  7. After removing content from site/init.php and site/ready.php for now (throwing errors about redeclared functions) I'm getting this now: throw new Exception("Unrecognized render method"); I'm invoking LinkCrawler like this within an external script which bootstraps processwire (so not within template file, maybe that's the problem?) if ($modules->get('ProcessLinkChecker')) { require $config->paths->siteModules . 'ProcessLinkChecker/LinkCrawler.php'; $crawler = new \LinkCrawler(); $crawler->start(); }
  8. Great module thanks teppo!! I can't edit crontab via ssh am only able to add crons via admin panel and there I can only provide a url and no path so without changing .htaccess I can't just run domain.com/site/modules/ProcessLinkChecker/Init.php..right? But I have already set up crons so I thought about copying contents of Init.php in an existing cron which should trigger it.. $linkCrawlerPath = $config->paths->siteModules . 'ProcessLinkChecker/LinkCrawler.php'; if (file_exists($linkCrawlerPath)) { require $linkCrawlerPath; $crawler = new \LinkCrawler(); $crawler->start(); } But then I'm getting those Notice: Undefined variable: wire in site/modules/ProcessLinkChecker/LinkCrawler.php on line 144Fatal error: Call to undefined function wire() in site/modules/ProcessLinkChecker/LinkCrawler.php on line 144 Uh, I'm running 3.0.25 that's why the backslash Any ideas? Or alternative paths? And, easier I included the Init.php in my cron script with the same result.. EDIT: Same error (at least the top one "undefined variable wire") when running from ProcessLinkChecker admin page..
  9. okay I was going to complain and argue "but what's the difference..bla bla.." but then I thought.."what ever just try it out" So now I'm having a running staging version on it's own subdomain..so exact clone of the live version but already updated to 3.0.25 only thing I needed to fix cookies by setting session name to default $config->sessionName = session_name(); YIPPIIEEEH!!!!! THANKS A LOT pwired!
  10. Annoying :/ Tried to copy my running pw installation (more like duplicating using ssh "cp -r" command) then created new db and imported a dump of the running installation Everything looks good front end etc but I'm not able to login into backend Now I ran a slightly different route, installed new devns 3.0.21 (I want to update anyway) then imported the db dump from running pw all good except that I can't login copied salt, changed sessionName to php's default session_name() like Ryan mentioned, disabled CSRF and fingerprint but no luck..changed admin password without any luck..uh ja..I'm not getting any messages and logs/sessions.txt says successfully logged in Can only thing works is $session->forceLogin($users->get(41)) but only if I keep this line active, as soon as I comment this line out and refresh backend I get the login form.. What can I do? I want this clone as staging server to test new developments before introducing at the running site..
  11. Welcome to the forums Flavia Glad you could solve it
  12. Hmm, maybe not getting you right..I basically get what you mean, but the pulling instance hasn't any site modules so there shouldn't be any collisions Here's the actual error Compile Error: require_once(): Failed opening required '/NEWINSTANCE/site/modules/HappyModules/HappyNotes.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.7/lib/php') (line 36 of /OLDINSTANCE/site/modules/HappyModules/HappySubscriber.module) So the new instance (no modules, no customizations, templatefiles or the like so far) isn't able to open HappyNotes.php which is of course not in it's site/modules and this instance is not including anything (besides core stuff of course) And this happens with your fix Without the fix I get a collision error (Cannot redeclare class Processwire\FieldtypePage).. Last time (other installation) it worked, I just wasn't able to login anymore..but at least I could import some pages etc from old instance..
  13. Would be awesome to get this working properly errors.txt is telling me about compile errors failed opening required php from one of my custom modules which is placed in secondary pw instance, so the one I'm trying to connect to.. feels like it should be possible without matching $config2 modules to $config modules..but without this line I'm getting Compile Error: Cannot redeclare class ProcessWire\FieldtypePage both ar 3.0.21 right now and the hosting instance trying to pull $config2 is fresh install without anything changed..
  14. Welcome Mélanie, would definitely go for 3x devns, I'm already using it on live projects and am working on migrating others, too..
  15. I already commented the blog post, that I especially love the multi-language toggle.. I think it would be great to be able to change almost any field setting in template context..
  16. I'm not using diff a lot but free diffy does the job for me so far And I had good times using FTPSync which is also free your mentions @gebeer got probably more features and support though..
  17. In the first requesting page I'll set $config->sessionName = session_name(); in config-dev.php (and I'm on dev) And to make sure I just changed the session name of hg8meta.. Noticed that the requesting page is setting PHPSESSID and after first login try hg8meta cookie too..guess that's right because it's booting that second page too right? UPDATE interestingly // doesn't work $config->sessionName = 'hg'; // works, even though PW usses session_name itself $config->sessionName = session_name('hg');
  18. Thought the same but the referenced page "happygaia8meta" got wire as session name whereas the requesting first page native php session_name() so this should be an issue right?
  19. Tried your code finally myself On the front end it works..but it kicks me out of admin and won't let me in anymore..just keeps showing login form..no log messagea as far as I can tell at least not in pw admin.. got this in /site/init.php $config2 = ProcessWire::buildConfig(realpath("../../happygaia8meta/"), 'http://www.hg8meta.dev'); $config2->paths->modules = $config->paths->modules; $wire->wire('happyMeta', new ProcessWire($config2)); after commenting this block out all good again.. Anybody a hint on that?
  20. How about adding media query grouping like http://stackoverflow.com/a/18191985/3484824? I've test implemented it at line 621 or maybe more accurately right before the "Write the minimized file to the file system" comment // search media query in CSS preg_match_all('#@media(.*?)\{(.+?}[ \n])\}#si',$_css,$match,PREG_SET_ORDER);//$MatchingString now hold all strings matching $pattern. $media = array(); // group same media query foreach ($match as $val) { if (!isset($media[$val[1]])) $media[$val[1]] = ''; $media[$val[1]] .= $val[2]; } // delete media query of cache $_css = preg_replace('#@media(.*?)\{(.+?}[ \n])\}#si', '', $_css); // add groups of media query at the end of CSS $final = $_css . "\n"; foreach ($media as $id => $val) { $final .= "\n" . '@media' . $id . '{' . $val . '}' . "\n"; } $_css = $final; // ------------------------------------------------------------------------ // Write the minimized file to the file system. // ------------------------------------------------------------------------ One optimization could be sort ordering of grouped media queries like min-width40em before min-width50em and so on.. OR # Recursively descend and match all `{ .. }` blocks. preg_match_all('#(?<media>(?:@media[^{]+)?){(??:[^{}]+)|(?R))*}#s', $_css, $captures); # Loop through all matches by key. foreach (array_keys($captures[0]) as $key) { # If the value does not contain a @media query, drop it from the array. Or # even if we found a @media query, make sure it was not within a string or # a comment. if (strpos($captures[0][$key], '@media') === FALSE || empty ($captures['media'][$key])) { unset ($captures[0][$key]); } } # Erase all @media queries from the input CSS. foreach ($captures[0] as $query) { $_css = preg_replace('#\s*' . preg_quote($query, '#') . '#u', '', $_css); } # Utility function to create an array key from a media query. function sanitize_media_query_for_key($query) { $key = trim($query); $key = preg_replace('#[^\w\d]+#u', '-', $key); $key = trim($key, '-'); return $key; } # For each @media query, group CSS code together. $groups = array(); foreach (array_keys($captures[0]) as $key) { $media = $captures['media'][$key]; # The code for this block starts off with the @media query in it... $code = $captures[0][$key]; # ...which then gets stripped off... $code = preg_replace('#' . preg_quote($media, '#') . '#u', '', $code); # ...and any leading or trailing curly bracket also gets removed. $code = preg_replace('#^{|}$#u', '', $code); # If this is the first time the @media query is encountered, a new group is # created. $group_key = sanitize_media_query_for_key($media); array_key_exists($group_key, $groups) OR ($groups[$group_key] = array($media, '{')); $groups[$group_key][] = $code; } $result = NULL; # Output is the input stripped of any @media queries... $result = $result . rtrim($_css); # ...followed by those @media queries grouped together. foreach (array_keys($groups) as $key) { $result = $result . PHP_EOL . PHP_EOL . implode(NULL, $groups[$key]) . '}'; } $_css = $result; from https://gist.github.com/StanAngeloff/3164569 but still sorting the result could be interesting(?) Couldn't figure it out myself so far..but it's late..
  21. Got more plugins, but recently discovered ToDo Review (thanks for the mention OrganizedFellow!) and really love it..always tried to find a way to organize some code notes/todo's but using a separate note app didn't work out because I forget to review it^^ Then I was in the process of writing a little PHP script which would scan project files for @todo and create a website, while coding a stumbled upon the ST3 plugin..yeah
  22. I'm coding more as a hobby..doing own projects, and some little sites for friends so time/money is not really a topic for me. But I still wanted to add my thoughts to the WP/PW fast coding comments as I just recently talked to my non-techy girlfriend about it cause a friend of us got a crappy WP shop set up.. I feel wordpress is "too" simple..everyone calls himself WP developer and charges more or less for creating websites in a matter of a few days.. You ever read "Processwire powered site hacked"? ... Before I dived into PW I used WP and Drupal..at this time I was way less experienced (PW helped me a lot in learning PHP, still I'm not a pro and make mistakes, but with PW it feels less dramatically) so setting up WP is quite easy and fast sure..adding whatever functionality you need by just enabling a plugin..but that's the time where problems come up...either the plugin is too bloated, not doing exactly what you want, outdated, or conflicting with another plugin or code you threw in.. So in the end you spend way more time in fixing and hacking all those issues you could have used to set up a proper and less vulnerable PW page in nearly the same time. And you can tell your customer that later maintenance or extension/customization will be way easier.. Sure there are great Wordpress blogs out there and if you're really just setting up a blog and now you won't add a shop or some other customization to it go for WP..everything else will benefit from Processwire..at least in my humble opinion Uh and the template shop thing..yeah somehow that might be cool to have and I'm quite sure someone might start something one day..but on the other hand you can easier fit the design more into the exact needs of the website and can always use css frameworks Or you can easily use design templates not made for a special system e.g. from template monster..or googling for free templates
×
×
  • Create New...