cKeditor and Elfinder don't load files to assets - yii2

After putting site to hosting, ckEditor and ElFinder don't work. I Tried to see view-source in browser
<script src="/assets/15f6a66f/ckeditor.js"></script>
This and other files in assets folder doesn't exists. How can I solve this issue?

Proplem is solved! I made some changes in WebConfig:
'components' => [
'assetManager' => [
'linkAssets' => true,
],
],
Another issue was on permission .htaccess. I changed owner permission to Read, Write and Execute with FileZilla. Both work

Related

yii2 starter kit console commands doesn't work

I have yii2 starter kit application and I am trying to run console commands but they're not working. For example I am staying in console folder and run command php yii migrate/up(or any other commands none of them run) but I see only this
Please help me with this issue.
I found a solution for this issue, a programmer before me, added this code below to common/config/base.php
'request' => [
'class' => 'common\components\lang\LangRequest',
],
I have moved this class to request section in frontend/config/web.php. And remove request section from common/config/base.php. Now console commands working perfectly.

Running Silverstripe with MAMP and Gulp

I'm trying to set up a local dev environment for a Silverstripe build which was set up by someone else. I'm not all that familiar with Silverstripe so am a bit lost as to how to do this. I can't share much of the code for security reasons but I can see that gulp is used for watching the local changes. Happy to provide what ever else is needed to get this going just cant provide specifics obviously.
Here is what I've done so far:
installed MAMP
cloned Repo to the htdocs folder within MAMP
run composer install in the root and npm install in the theme directory
turned on the MAMP server - am redirected to localhost:8888
have gone to the localhost:8888/repo and am shown the error - cannot find index.php
When I run gulp the browser opens a localhost:3000 page but it never completes loading, rather it hangs.
I understand the index.php error but the previous dev had this running with the current set up so I am hoping to not move anything around just yet. There is a 'public' folder with an index.php file in it if there is a way I can tell the server to look here for it.
composer.json Contents:
{
"name": "silverstripe/installer",
"type": "silverstripe-recipe",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.6.0",
"silverstripe/recipe-plugin": "^1.2",
"silverstripe/recipe-cms": "4.2.1#stable",
"silverstripe-themes/simple": "~3.2.0",
"loeken/cryptocompare-api-php-wrapper": "dev-master",
"zendesk/zendesk_api_client_php": "^2.2",
"intercom/intercom-php": "^3.2",
"tractorcow/silverstripe-fluent": "^4",
"silverstripe/googlesitemaps": "dev-master",
"ryanpotter/silverstripe-cms-theme": "^3.3"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"deployer/deployer": "^6.2",
"lekoala/silverstripe-debugbar": "^2.0"
},
"extra": {
"project-files-installed": [
"app/.htaccess",
"app/_config.php",
"app/_config/mysite.yml",
"app/src/Page.php",
"app/src/PageController.php"
],
"public-files-installed": [
".htaccess",
"index.php",
"install-frameworkmissing.html",
"install.php",
"web.config"
]
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
Any suggestions of what to try next would be greatly appreciated. Nothing I can find online seems to mention using gulp and MAMP in tandem - unsure If I'm just understand their purpose incorrectly.
Cheers
I need '50 reputation' to comment so I will instead reply as an answer.
It sounds like you are using SilverStripe version ^4.1, since you got the 'public' folder.
Do the following:
Make sure you got a .htaccess file in the root (outside public folder) which redirects all requests to the public folder:
(root .htaccess)
RewriteEngine On
RewriteRule ^(.*)$ public/$1
Run composer vendor-expose in the root to expose all files which should be accessed by the visitors, (custom css, js, images etc...). The files & folders that gets exposed are specified in the composer.json file under "expose": [...]. The files gets copied over to the public folder

Yii 2 - Overriding files of mdm extension in vendor to extension folder using aliases in config

I have installed mdm extension for admin in basic version of Yii2, that is located in vendor directory and I want to override some files into extension directory for UI changes, I referred this link and added some code in web and console file as:
'aliases' => [
'#mdm/admin' => '#app/extensions/mdm/yii2-admin',
],
But no changes are reflected after doing this.
Most likely version installed by Composer conflicts with version which you unpacked manually. Instruction in documentation are for installing extension without using Composer, so they're definitely not considering the fact, that you have the same extension installed in two different places.
If you want to edit this extension you should uninstall composer version and copy whole extension into extensions/mdm/yii2-admin.
But probably better option would be to fork it, and add repository to your composer.json which will point to your fork:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/yourname/yii2-admin.git"
}
],
And change dependency constraints to use master branch:
"require": {
"mdmsoft/yii2-admin": "dev-master as 2.8.0",
// ...
},
Then all necessary changes you're preforming in your fork (at https://github.com/yourname/yii2-admin.git) and fetching changes to main project using composer update mdmsoft/yii2-admin. It will simplify syncing changes from upstream - you just need to merge changes for upstream if you want to update your fork with lates changes from original extension repository.

Visual Studio Code debugging chrome, Breakpoints wont hit

I have a Angular2/typescript app I am developing in VSCode. I use Gulp to build the typescript files and gulp-sourcemap to create map files. Attaching/launching chrome works well after some tinkering with the chrome debug extension for VSCode, but I cannot get the breakpoints to hit. I run the website with "dnx web", but I don't think that should matter.
My folder structure is like this:
project/wwwroot/index.html
project/wwwroot/app/myfile.js
project/wwwroot/app/myfile.js.map
project/scripts/myfile.ts
My launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8001/portfolios",
"runtimeArgs": [
"--new-window", //Open in new window
"--user-data-dir=C:/temp/",
"--remote-debugging-port=9222"
],
"webRoot": "${workspaceRoot}/wwwroot",
"sourceMaps": true
}
]
}
and my gulp build task looks like this:
gulp.task('ts', function (done) {
var files = gulp.src(tsToMove)
.pipe(sourcemaps.init())
.pipe(ts(tsConfig), undefined, ts.reporter.fullReporter());
return files.js.pipe(sourcemaps.write(".",{sourceRoot: '../scripts'}))
.pipe(gulp.dest('scripts'));
})
I have verified that maps files are generated and stored in the same folder as the js files. when building.
Thanks for any hints.
Setting the workspace location to the location of my typescript files, and not my build files, worked for me.
Unverified Breakpoint (my compiled file location)
"webRoot": "${workspaceRoot}/build/client"
Working Breakpoint (my ts file location)
"webRoot": "${workspaceRoot}/client"
I feel I should mention that I am using the Debugger for Chrome extension
So I've been messing with this for hours and finally got it working: RVCA18 was right on with his answer:
You need to make sure that webRoot is set correctly, and correctly will depend on where you are running dnx from. If from your 'project' folder, then that's your actual webRoot.
You can also use your sourcemap file. If you open the file, it has a structure something like this:
{"version":3,"sources":[],"names":[],"sourcesContent":[]}
Find the sources prop which is an array of all of your source files. For example, if I search for one of my class names, I find the source to be something like: "webpack:///./app/components/TargetCard.js". I am using webpack and have a dir structure like below (simplified):
main
app
dist
which means that my webRoot as far as VSCode is concerned should equate to the dir one level above 'app', or 'main'. This is also where I run webpack from, so it makes sense. If I open the 'main' folder in VSCode, then my ${workspaceRoot} will also be 'main', so to have the debugger find my files I should set webRoot to simply be ${workspaceRoot}.
If you are using the debugger for chrome extension I would check that you are running chrome with remote debugging?
I was able to get mine working after I started running chrome with remote debugging.
from https://code.visualstudio.com/blogs/2016/02/23/introducing-chrome-debugger-for-vs-code
For now, Chrome needs to be started with remote debugging enabled, and only supports one concurrent connection. This means if you open up DevTools inside Chrome, the connection to VS Code will get terminated by Chrome. This is slightly annoying, and we hope this issue will be fixed sometime soon.
To do this i have a batch file that opens chrome with this command.
start /d "C:\Program Files (x86)\Google\Chrome\Application" chrome.exe --remote-debugging-port=9222
I totally agree with RVCA18. It's about the webRoot Setting that was wrong.
I had VS-Code ${workspaceRoot} pointing to a subfolder (just because I opened the project like that and had no script in the top-level folder). Since the index.html that is launched is in the top level folder I had to set the following Option in launch.json
"webRoot": "${workspaceRoot}/.."
For me, the problem occured in Visual Studio Code, using addons "Debugger for Chrome" with "Live Server".
I got it to work with the following settings:
Live Server's settings.json:
"liveServer.settings.AdvanceCustomBrowserCmdLine": "chrome --user-data-dir=C:/tmp --remote-debugging-port=9222",
launch.json:
"configurations": [
{
"name": "Attach to Chrome",
"port": 9222,
"request": "attach",
"type": "pwa-chrome",
"url": "http://127.0.0.1:5500/${relativeFile}",
"sourceMaps": true,
"webRoot": "${workspaceFolder}"
},

Firebase deploy error on public key / directory

I am building an IOS app using Firebase. I have an error when I try to deploy
"Error: Specified public directory does not exist, can't deploy hosting"
I have been following the hosting guide here Guide Link But being new learner, I am not understanding what should I put in firebase.json
So my code in firebase.json
{
"firebase": "xxxxxx", //(my app name)
"public": "/usr/local", //(I am not sure what should i put in here)
"ignore": [
"firebase.json",
"**.*",
"**/node_modules/**"
]
}
I am not sure what should I put in "public" property. I think that is the reason why I get the error. I don't understand what public directory mean in here.
Easily deploy and host your app's static assets (HTML, CSS,
JavaScript, etc) with our production-grade hosting service. All of
your content is served over HTTPS and backed by a global CDN.
It cleary states only static thing is expected to be hosted.
In "public" you are supposed to put dist (distribution) folder distination, In web apps Its a folder that contains all assets to keep app up and running on firebase hosting service.
Above answer is to clear Concept, Provide more details of your app and structure for further help.
what are you building your app with?
I imagine the cause of the error is that you need to generate a 'dist' folder for your app and you haven't done that yet before running 'firebase deploy'.
Check the firebase.json file in your project directory, it will show you that Firebase is looking for a dist folder to read from.
IF it can't find it, you will get the error that you have.
For instance, if it is an Angular2 application and you use the Angular-cli, just do the following:
Run the command 'ng build' in your project's root directory.
This command will generate a 'dist' folder from the 'src' folder where you wrote your application code.
Then run '
firebase deploy'.