Photorefractive effects in waveguides