-
Posts
295 -
Joined
-
Last visited
Everything posted by Orkun
-
I have a pagetable field called "partner_create_events" where partners should be able to create new Events. Now at the moment there are already Events from last year. I tried to hide these Event Pages inside the admin table view with a hook. But somehow when you add a new pagetable item it doesn't execute the hook and I don't know why. I tought it would work, since InputfieldPageTableAjax.php is calling the render() Method inside renderAjax(). Can you help please? My code is inside ready.php under /site/. $wire->addHookBefore("InputfieldPageTable::render", function(HookEvent $event) { $obj = $event->object; if($obj->name == 'partner_create_events') { $pagearray = $obj->value; $newpagearray = wire('pages')->find("id=$pagearray, select_year.id=2"); $obj->value = $newpagearray; } }); KR Orkun
-
Hi Guys How can I adjust the view links inside the dropdown? I could only manage to adjust the normal view link with a hook to ProcessPageEdit::buildFormView. KR Orkun
-
@kongondo Even when I try to delete the contents under /site/assets/cache/Filecompiler/ it doesn't help anything. The error still persists. JqueryFileUpload is on Version 0.0.8 KR Orkun
-
Hi @kongondo We buyed the latest Version of Media Manager and I tried to upgrade our old Version (0.9) by moving the old module contents inside a ".old" folder and upload the new module files and folder. But now I am getting this error all the time, I can't access the backend anymore. What I am doing wrong? PW Version is 3.0.165
-
Backend is slower after converting tables from MyISAM to InnoDB
Orkun replied to Orkun's topic in General Support
Hi @flydev ?? When I execute SHOW FULL PROCESSLIST on phpmyadmin while opening the corresponding page with the sharecontent field the following Query is executed for the shareContent pagefield. SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` WHERE ((pages.parent_id=27200 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=27200 OR pages_id=27200)) OR (pages.parent_id=33509 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=33509 OR pages_id=33509)) OR (pages.parent_id=36093 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=36093 OR pages_id=36093)) OR (pages.parent_id=47499 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=47499 OR pages_id=47499)) OR (pages.parent_id=50748 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=50748 OR pages_id=50748)) OR (pages.parent_id=51240 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=51240 OR pages_id=51240)) OR (pages.parent_id=51268 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=51268 OR pages_id=51268)) OR (pages.parent_id=51433 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=51433 OR pages_id=51433)) OR (pages.parent_id=51466 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=51466 OR pages_id=51466)) OR (pages.parent_id=51644 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=51644 OR pages_id=51644)) OR (pages.parent_id=53775 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=53775 OR pages_id=53775)) OR (pages.parent_id=56496 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=56496 OR pages_id=56496)) OR (pages.parent_id=56824 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=56824 OR pages_id=56824)) OR (pages.parent_id=57297 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=57297 OR pages_id=57297)) OR (pages.parent_id=57316 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=57316 OR pages_id=57316)) OR (pages.parent_id=64013 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64013 OR pages_id=64013)) OR (pages.parent_id=64034 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64034 OR pages_id=64034)) OR (pages.parent_id=64051 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64051 OR pages_id=64051)) OR (pages.parent_id=64067 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64067 OR pages_id=64067)) OR (pages.parent_id=64162 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64162 OR pages_id=64162)) OR (pages.parent_id=64167 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64167 OR pages_id=64167)) OR (pages.parent_id=64172 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64172 OR pages_id=64172)) OR (pages.parent_id=64698 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=64698 OR pages_id=64698)) OR (pages.parent_id=65617 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=65617 OR pages_id=65617)) OR (pages.parent_id=68889 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=68889 OR pages_id=68889)) OR (pages.parent_id=79707 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=79707 OR pages_id=79707)) OR (pages.parent_id=80789 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=80789 OR pages_id=80789)) OR (pages.parent_id=106083 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=106083 OR pages_id=106083)) OR (pages.parent_id=156188 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=156188 OR pages_id=156188)) OR (pages.parent_id=157310 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=157310 OR pages_id=157310)) OR (pages.parent_id=157321 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=157321 OR pages_id=157321)) OR (pages.parent_id=157331 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=157331 OR pages_id=157331)) OR (pages.parent_id=163387 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=163387 OR pages_id=163387)) OR (pages.parent_id=172378 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=172378 OR pages_id=172378)) OR (pages.parent_id=172767 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=172767 OR pages_id=172767)) OR (pages.parent_id=174477 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=174477 OR pages_id=174477)) OR (pages.parent_id=174505 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=174505 OR pages_id=174505)) OR (pages.parent_id=175606 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=175606 OR pages_id=175606)) OR (pages.parent_id=177162 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=177162 OR pages_id=177162)) OR (pages.parent_id=190556 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=190556 OR pages_id=190556)) OR (pages.parent_id=196026 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=196026 OR pages_id=196026)) OR (pages.parent_id=197635 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=197635 OR pages_id=197635)) OR (pages.parent_id=198626 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=198626 OR pages_id=198626)) OR (pages.parent_id=201550 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=201550 OR pages_id=201550)) OR (pages.parent_id=201959 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=201959 OR pages_id=201959)) OR (pages.parent_id=201981 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=201981 OR pages_id=201981)) OR (pages.parent_id=202026 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=202026 OR pages_id=202026)) OR (pages.parent_id=202060 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=202060 OR pages_id=202060)) OR (pages.parent_id=202082 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=202082 OR pages_id=202082)) OR (pages.parent_id=202127 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=202127 OR pages_id=202127)) OR (pages.parent_id=203241 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=203241 OR pages_id=203241)) OR (pages.parent_id=203680 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=203680 OR pages_id=203680)) OR (pages.parent_id=207998 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=207998 OR pages_id=207998)) OR (pages.parent_id=208009 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=208009 OR pages_id=208009)) OR (pages.parent_id=208585 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=208585 OR pages_id=208585)) OR (pages.parent_id=221432 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=221432 OR pages_id=221432)) OR (pages.parent_id=230765 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=230765 OR pages_id=230765)) OR (pages.parent_id=236703 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=236703 OR pages_id=236703)) OR (pages.parent_id=248817 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=248817 OR pages_id=248817)) OR (pages.parent_id=270368 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=270368 OR pages_id=270368)) OR (pages.parent_id=278456 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=278456 OR pages_id=278456)) OR (pages.parent_id=278852 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=278852 OR pages_id=278852)) OR (pages.parent_id=288591 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=288591 OR pages_id=288591)) OR (pages.parent_id=294584 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=294584 OR pages_id=294584)) OR (pages.parent_id=294616 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=294616 OR pages_id=294616)) OR (pages.parent_id=295254 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=295254 OR pages_id=295254)) OR (pages.parent_id=295285 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=295285 OR pages_id=295285)) OR (pages.parent_id=295318 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=295318 OR pages_id=295318)) OR (pages.parent_id=295351 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=295351 OR pages_id=295351)) OR (pages.parent_id=295383 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=295383 OR pages_id=295383)) OR (pages.parent_id=298000 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=298000 OR pages_id=298000)) OR (pages.parent_id=298029 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=298029 OR pages_id=298029)) OR (pages.parent_id=306300 OR pages.parent_id IN (SELECT pages_id FROM pages_parents WHERE parents_id=306300 OR pages_id=306300))) AND (pages.templates_id!=285 AND pages.templates_id!=286 AND pages.templates_id!=287 AND pages.templates_id!=259) AND (pages.status<1024) GROUP BY pages.id When I execute the SQL in the SQL Tab in phpmyadmin it has 0.5476s to show me the results. I have also executed SHOW ENGINE INNODB STATUS in phpmyadmin while opening the corresponding page but I don't really understand the log output: ===================================== 2020-08-25 11:37:20 0x7f079867d700 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 1 seconds ----------------- BACKGROUND THREAD ----------------- srv_master_thread loops: 16026 srv_active, 0 srv_shutdown, 1200775 srv_idle srv_master_thread log flush and writes: 1216801 ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 104559 OS WAIT ARRAY INFO: signal count 114239 RW-shared spins 0, rounds 48936, OS waits 16344 RW-excl spins 0, rounds 3890013, OS waits 77782 RW-sx spins 8420, rounds 138928, OS waits 1539 Spin rounds per wait: 48936.00 RW-shared, 3890013.00 RW-excl, 16.50 RW-sx ------------ TRANSACTIONS ------------ Trx id counter 1297101 Purge done for trx's n:o < 1297094 undo n:o < 0 state: running but idle History list length 0 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 421145577143032, not started 0 lock struct(s), heap size 1136, 0 row lock(s) -------- FILE I/O -------- I/O thread 0 state: waiting for completed aio requests (insert buffer thread) I/O thread 1 state: waiting for completed aio requests (log thread) I/O thread 2 state: waiting for completed aio requests (read thread) I/O thread 3 state: waiting for completed aio requests (read thread) I/O thread 4 state: waiting for completed aio requests (read thread) I/O thread 5 state: waiting for completed aio requests (read thread) I/O thread 6 state: waiting for completed aio requests (write thread) I/O thread 7 state: waiting for completed aio requests (write thread) I/O thread 8 state: waiting for completed aio requests (write thread) I/O thread 9 state: waiting for completed aio requests (write thread) Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] , ibuf aio reads:, log i/o's:, sync i/o's: Pending flushes (fsync) log: 0; buffer pool: 0 6188 OS file reads, 649778 OS file writes, 153914 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 3, seg size 5, 11 merges merged operations: insert 1, delete mark 237, delete 0 discarded operations: insert 0, delete mark 0, delete 0 Hash table size 9313853, node heap has 579 buffer(s) Hash table size 9313853, node heap has 439 buffer(s) Hash table size 9313853, node heap has 221 buffer(s) Hash table size 9313853, node heap has 531 buffer(s) Hash table size 9313853, node heap has 341 buffer(s) Hash table size 9313853, node heap has 389 buffer(s) Hash table size 9313853, node heap has 362 buffer(s) Hash table size 9313853, node heap has 352 buffer(s) 0.00 hash searches/s, 0.00 non-hash searches/s --- LOG --- Log sequence number 2655708824 Log flushed up to 2655708824 Pages flushed up to 2655708824 Last checkpoint at 2655708815 0 pending log flushes, 0 pending chkp writes 50740 log i/o's done, 0.00 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total large memory allocated 34632105984 Dictionary memory allocated 6517869 Buffer pool size 2064384 Free buffers 1874861 Database pages 186309 Old database pages 68733 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 48, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 6067, created 180242, written 516273 0.00 reads/s, 0.00 creates/s, 0.00 writes/s Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000 Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s LRU len: 186309, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---------------------- INDIVIDUAL BUFFER POOL INFO ---------------------- ---BUFFER POOL 0 Buffer pool size 1032192 Free buffers 937631 Database pages 92955 Old database pages 34293 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 8, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 3161, created 89794, written 363661 0.00 reads/s, 0.00 creates/s, 0.00 writes/s Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000 Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s LRU len: 92955, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 1 Buffer pool size 1032192 Free buffers 937230 Database pages 93354 Old database pages 34440 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 40, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 2906, created 90448, written 152612 0.00 reads/s, 0.00 creates/s, 0.00 writes/s Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000 Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s LRU len: 93354, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] -------------- ROW OPERATIONS -------------- 0 queries inside InnoDB, 0 queries in queue 1 read views open inside InnoDB Process ID=840, Main thread ID=139635091044096, state: sleeping Number of rows inserted 60809038, updated 3818, deleted 81140, read 840337245 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 3740958.04 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================ -
Backend is slower after converting tables from MyISAM to InnoDB
Orkun replied to Orkun's topic in General Support
Hi @flydev ?? I had contact my host that they should set the innodb_buffer_pool_size to 70% of the available RAM based on this article here https://mariadb.com/kb/en/converting-tables-from-myisam-to-innodb/. I didn't heard anything from them yet. Server RAM is 64GB I also have done some code refactoring for the specific field which helped a little bit. On the live site/live server I had this code inside a pagefield in the custom php code setting: // Didn't use the has_parent selector here because it was buggy (not collecting all childrens) $roots = wire('pages')->find("template=domain_root, id!=64098"); $pagearray = new PageArray(); foreach($roots as $root){ $pagearray->import($root->find("template!=pikettdienst-overview|pikettdienst-category|pikett-date|calendar-item")); } $event->return = $pagearray; The TTFB is 3.28s. PW Version is 2.7.3 and MyISAM Engine DOMContentLoaded: 4.37 and Load: 4.40s ----------------------- On the dev site/dev server I had refactored this code to this and placed it inside the /site/ready.php: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'shareContent') { $rootIds = wire('pages')->findIDs("template=domain_root, id!=64098"); $pagearray = new PageArray(); if(wireCount($rootIds) > 0) { $rootIds = implode("|", $rootIds); $pagearray = wire('pages')->find("has_parent=$rootIds, template!=pikettdienst-overview|pikettdienst-category|pikett-date|calendar-item"); } $event->return = $pagearray; } }); The TTFB is 6.28s. PW Version is 3.0.165 and InnoDB Engine. Before refactoring the TTFB was 10s. DOMContentLoaded: 11.85s and Load: 12.90s When I deactive the AdminThemeUikit and use the classic one it loads faster. DOMContentLoaded: 7.15s and Load: 7.20s but TTFB stays same. Why is the AdminThemeUikit so much slower? -
Hi @Zeka Thank you for the clarification!
-
Hi @fruid Perhaps you can copy the TextformatterMakeLink Module and adjust it to your needs and then select the new adjusted Module inside the requested textarea field? KR Orkun
-
Hi @Zeka Would it be a good idea to make cronjob which executes this code daily and takes care of that? Or should i only use it, when I stumble upon anywhere? Or is it enough, when I have used it once? KR Orkun
-
Today I have changed the DB Engine from MyISAM to InnoDB with the search and replace technique which is stated here at the end https://processwire.com/blog/posts/using-innodb-with-processwire/. But somehow some pages where I have a pagefield (which holds a lot of pages) loads in 1 Minute when I try to edit the page in the backend. Before the InnoDB change it loaded in 6-7 seconds when I edited. What else do I need to consider when converting to InnoDB? As far as I know the "innodb_buffer_pool_size" is set to 11.75 GB. KR Orkun
-
Hi @kongondo Thanks for your input. I have now adjusted the post_max_size to 1G and the memory_limit to 2G since according to the php docs memory_limit needs also to be bigger than post_max_size. Will see if this helps. It is very strange that this SQL Error appears, I mean I have the following setting in MM for duplicate Media (see screenshot). Normally It should just replace the existing media if there is a duplicate. Could perhaps my change (that I had done a long time ago) for setting the page title for all languages be a problem? (line 1558) ------------------------------------------------------------------------------------------------------- You are right, that a upgrade to version 3 (PW) and to the newest MM Version would be a good idea. But the problem is, that the system is a very big and complex (Multi-Lang, Multi-Site: approximately 15-20+ Websites, A lot of modules etc...) Processwire Installation. And also there are a lot of users/editors that are editing daily. Because of this the upgrade isn't easily feasible. I had already started on a dev environment to upgrade to Version 3 and to trackdown all the problems that could appear and document them... Are there any points I need to watch on when upgrading the Media Manager? What problems could occur when upgrading (like for example media getting deleted or something?) KR Orkun
-
Hi @kongondo This Problem still happens regularly. It is always the "Empty File Upload Result" Error. In the Processwire Logs it is a SQL Duplicate Entry Error (See Screenshot).The only way to make this work again temporarly was to delete the contents of /site/assets/MediaManager/jqfu/.files_no_show/ Processwire Version: 2.7.3 Dev PHP Version: 7.0.33-0ubuntu0.16.04.15 Media Manager Version: Media Manager (Process) v0.0.9 β post_max_size: Local Value(512M), Master Value(8M) memory_limit: Local Value(512M), Master Value(128M) file_uploads: On upload_max_filesize: Local Value(512M), Master Value(2M) It is also not a Windows Machine. That's what the customer had said to me today. Can you help me on this one? KR Orkun
-
Ok this works for me now: require_once wire('config')->paths->RestApi . "Router.php"; $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { $url = wire('sanitizer')->url(wire('input')->url); // support / in endpoint url: $endpoint = str_replace("/", "\/", wire('modules')->RestApi->endpoint); $regex = '/^\/'.$endpoint.'\/?.*/m'; preg_match($regex, $url, $matches); $hasAccess = array( '178.192.77.1' ); if($matches) { if(!in_array($_SERVER['REMOTE_ADDR'], $hasAccess)){ wire('log')->save("sso-debug", "Access denied for ".$_SERVER['REMOTE_ADDR']); http_response_code(403); exit; } $event->replace = true; } }, [ 'priority' => 99 ]); I have added the priority option and set it to 99 so that it gets executed before your hook in RestApi Module. KR Orkun
-
I tried this by creating a init.php file insdie /site/ with this content in it, but the go method of the router class from your RestApi.module is still executed. <?php require_once wire('config')->paths->RestApi . "/Router.php"; $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { $url = wire('sanitizer')->url(wire('input')->url); // support / in endpoint url: $endpoint = str_replace("/", "\/", wire('modules')->RestApi->endpoint); $regex = '/^\/'.$endpoint.'\/?.*/m'; preg_match($regex, $url, $matches); $hasAccess = array( '178.192.77.1' ); if($matches) { $event->replace = true; if(in_array($_SERVER['REMOTE_ADDR'], $hasAccess)){ wire('log')->save("sso-debug", "Access granted for ".$_SERVER['REMOTE_ADDR']); Router::go(); } else { wire('log')->save("sso-debug", "Access denied for ".$_SERVER['REMOTE_ADDR']); throw new \Exception("Access denied!", 400); } } }); What can I do? KR Orkun
-
Looks like this happens only when the ckeditor field is in inline mode. In regular mode the images added at the position where my cursor is. Is this a expected behavior or a bug? KR Orkun
-
Hi Guys When I try to add an Image inside the CKEditor Field, that Image always gets added to the TOP instead there where the cursor was. Do you know why this problem happens? KR Orkun
-
Hi @thomasaull Do you know what the best way is to restrict the API Requests for specific IP Adresses? KR Orkun
-
Hi @kongondo Is it normal that the folder in /site/assets/MediaManager/jqfu/.files_no_show/ is full of files/duplicate files? We can't upload any files anymore, because we are getting the error of duplicate media page (empty file upload result). It looks like he tries to create a page from a file from the .files_no_show folder but that page with the name already exists. Isn't the /site/assets/MediaManager/jqfu/.files_no_show/ just a temporary folder? Shouldn't be the file deleted after the media page was created? KR Orkun
-
Hi all I found a tool which "fixed" the mp3 file so that I could upload it again in media manager. I used the tool https://www.deepniner.net/mp3trimmer/, but it also works with the https://audiotrimmer.com/ online tool. I think it removes all non-audio data from the mp3 file. KR Orkun
-
@kongondo Any news on this? What I could do is, is to add the "application/octet-stream" mimetype for mp3 extensions. I could do this inside the method "mimeTypes" of the File "MediaManagerUtilities.php" but don't know if this is a good Idea. KR Orkun
-
Hi @kongondo We have a problem with uploading some mp3 files. We can't upload a specific .mp3 file in the media manager because on the server it returns application/octet-stream as mime-type instead of audio/mpeg. But when I check with finfo or mime_content_type on a localhost it returns audio/mpeg mimetype. Even when I check the mime-type on the mac osx terminal (file --mime-type -b filename) it returns audio/mpeg. What should I do? I also can't find an online tool where the customer could repair the mp3 file or something. I downloaded the file from the dropbox account/link of the customer. The funny thing is, when i convert that mp3 file to wav it can be uploaded. KR Orkun
-
Hi @Craig A Rodway Ok thank you very much! I have made now a function called ssoLogin() and place the hook inside /site/ready.php: function ssoLogin() { if(!wire('user')->isLoggedin()) { $token = wire('input')->get('token'); // If not token, show error? try { $decoded = JWT::decode($token, wire('modules')->RestApi->jwtSecret, array('HS256')); } catch (\Exception $e) { // Error parsing/decoding token - do not accept. Show error/redirect. } // print_r($decoded); // Find user based on supplied email. // Use other PW user fields or properties from JWT as necessary. $u = wire('users')->get('email=' . wire('sanitizer')->selectorValue($decoded->claims->email)); if ( ! $u->id) { // Could not find user - don't exist. // Could create them at this point, if you have enough detail in the JWT to do so. } // Force user login return wire('session')->forceLogin($u); } return false; } // Inside /site/ready.php $this->addHookAfter('PageRender::renderPage', function(HookEvent $event) { if (strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0 || $this->wire('page')->template->name == 'admin') return; ssoLogin(); }); KR Orkun
-
Hi @Craig A Rodway Thank you very much! I tested it and it works great. One question though, where would you place the code above? I placed it for the moment inside the _init.php because it is prepend for every template. KR Orkun
-
Hi Guys We are trying to build a Login Mask (with Node.js) which should act as a single sign on for two websites. The first website is a angular project on firebase the other one is processwire. We are trying to achieve the project with JWTs (Json Web Tokens). My Question is how can I make a user be loggedin in processwire with a JWT? Has someone experiences with this?
-
Hi @thomasaull As you can see in the second & third screenshot above, I am already setting it in Postman. But perhaps I could try it with a js file localy. Another question. How would you save the JWT Token after you have get it from the /api/auth endpoint? Cookie? Local Storage? DB? I mean after I got the JWT Token i need to set it for every other API Request inside the Header and for that I need to somehow save it somewhere, am I right? KR Orkun